[issue31975] Add a default filter for DeprecationWarning in __main__

Nick Coghlan report at bugs.python.org
Thu Nov 9 02:04:06 EST 2017


Nick Coghlan <ncoghlan at gmail.com> added the comment:

I'm currently still too annoyed to write a PEP about this - it would probably come out in tone like the state of the unicode literals PEP before I edited it.

I just don't understand how this logic is hard: *our* primary responsibility for deprecation warnings is to ensure that Python developers (including us) can alert other *Python developers* as to upcoming API breakages.

Yet somehow this primary goal has been subordinated to "app developers are bad at managing whether or not deprecation warnings are shown to their users, so it's OK that we ended up breaking deprecation warnings in general for everyone that doesn't run a test suite, even though we didn't realise that's what we were doing at the time we made the decision".

And I'll repeat: I'm entirely happy with the "revert the change for __main__ only" compromise, since it covers all the cases I care about.

If folks are also running third party single file scripts, and those scripts are emitting warnings, and they really hate seeing those warnings, then they can put "PYTHONWARNINGS=ignore::DeprecationWarning" into their shell profile.

----------

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


More information about the Python-bugs-list mailing list