New submission from Nick Coghlan <[email protected]>:
As per the post at
https://mail.python.org/pipermail/python-dev/2017-November/150366.html, this is
an RFE to cover adding a new warning filter to the default set:
once::DeprecationWarning:__main__
This means that all deprecation warnings triggered directly by code in __main__
will start being reported again, while deprecation warnings triggered by
imported modules will continue to be ignored by default.
Thus the following will start emitting DeprecationWarning by default again (as
they did in 2.6 and earlier):
- experiments at the REPL
- directly executed scripts
- modules executed with the -m switch
- pkg.__main__ submodules executed with the -m switch
- __main__.py files in executed directories and zip archives
However, any code *imported* from these will not trigger warnings.
This means that the following still won't trigger any warnings by default:
- modules imported & functions called from entry point wrapper scripts
- modules imported & functions called from pkg.__main__ submodules
- modules imported & functions called from __main__.py files
The intent behind the change is that it should be much harder for developers
and educators to miss seeing a deprecation warning at least once for a
deprecated API, while still silencing deprecation warnings by default for
deployed Python applications.
----------
messages: 305801
nosy: alex, gvanrossum, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add a default filter for DeprecationWarning in __main__
type: enhancement
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31975>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com