[Python-Dev] Show DeprecationWarning in debug mode?
ncoghlan at gmail.com
Sun Nov 19 01:36:20 EST 2017
On 18 November 2017 at 11:22, Victor Stinner <victor.stinner at gmail.com> wrote:
> I noticed that Python not only hides DeprecationWarning, but also
> PendingDeprecationWarning and ImportWarning by default. While I
> understand why we decided to hide these warnings to users for a Python
> compiled in release mode, why are they hidden in Python debug builds?
> I'm asking the question because in debug mode, Python shows
> ResourceWarning warnings (whereas these warnings are hidden in release
> mode). Why only displaying ResourceWarning, but not other warnings in
> debug mode?
I don't recall the exact reasoning (if I ever even knew it), but if I
had to guess, it would just be because ResourceWarning is newer than
BytesWarning has its own control flags and shouldn't be on by default
even in debug builds, but I think it would be reasonable to have at
least ImportWarning (which our own test suite should never be hitting)
and DeprecationWarning on by default in debug builds.
For PendingDeprecationWarning, I don't really mind either way, but
"everything except BytesWarning, because that has its own dedicated
command line flags" would be an easier guideline to remember.
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev