[Python-Dev] PEP 565: Show DeprecationWarning in __main__

Victor Stinner victor.stinner at gmail.com
Mon Nov 13 11:27:17 EST 2017


> The change proposed in this PEP is to update the default warning filter list
> to be::
>
>     default::DeprecationWarning:__main__
>     ignore::DeprecationWarning
>     ignore::PendingDeprecationWarning
>     ignore::ImportWarning
>     ignore::BytesWarning
>     ignore::ResourceWarning

This PEP can break applications parsing Python stderr, application
which don't expect to get DeprecationWarning in their output.

Is it possible to disable this PEP using a command line option and/or
environment variable to get the Python 3.6 behaviour (always
DeprecationWarning)?

I guess that it's
"PYTHONWARNINGS=ignore::DeprecationWarning:__main__". Am I right?
Would you mind to mention that in the PEP, please?

Sorry, I'm not an expert of the warnings module. Is it possible to
also configure Python to ignore DeprecationWarning using the warnings
module, at the start of the __main__ script? Something like
warnings.filterwarnings("ignore", '', DeprecationWarning)? Again,
maybe explain that in the PEP?

Victor


More information about the Python-Dev mailing list