[New-bugs-announce] [issue46068] Change use of warnings.warn to logging.warning in a few places

Andrei Kulakov report at bugs.python.org
Mon Dec 13 17:45:12 EST 2021


New submission from Andrei Kulakov <andrei.avk at gmail.com>:

In discussion on https://github.com/python/cpython/pull/29910 related to whether to use warnings.warn or logging.warning, I found two places in the library where it might make sense to change to logging.warning. There's probably other instances where the same change can be made but it's not easy to tell just by going through the list because the difference of when use one or the other is not always clearcut. If more instances are found, they can be added to this issue.

https://docs.python.org/3/howto/logging.html#when-to-use-logging

https://github.com/python/cpython/blob/eb483c46d62707bdf705491f76cf1fa9642fb47e/Lib/zoneinfo/_tzpath.py#L44

https://github.com/python/cpython/blob/f42a06ba279c916fb67289e47f9bc60dc5dee4ee/Lib/zipfile.py#L1480

The downside of making this change is that it may break 3rd party unit tests.

----------
components: Library (Lib)
messages: 408488
nosy: andrei.avk
priority: low
severity: normal
status: open
title: Change use of warnings.warn to logging.warning in a few places
type: behavior
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46068>
_______________________________________


More information about the New-bugs-announce mailing list