[issue32230] -X dev doesn't set sys.warnoptions

STINNER Victor report at bugs.python.org
Wed Dec 6 06:48:33 EST 2017


STINNER Victor <victor.stinner at gmail.com> added the comment:

I prefer to not talk about sys.warnoptions since, as you wrote, the order is reversed.

IMHO the priority should be (high priority > low priority):

  -W options > PYTHONWARNINGS > BytesWarning > -X dev > default filters

With:

* BytesWarning: "ignore" by default, "default" for -b, "error" for -bb.
* default filters: 4 filters added in release mode

[('ignore', None, <class 'DeprecationWarning'>, None, 0),
 ('ignore', None, <class 'PendingDeprecationWarning'>, None, 0),
 ('ignore', None, <class 'ImportWarning'>, None, 0),
 ('ignore', None, <class 'ResourceWarning'>, None, 0)]

  or 1 filter for pydebug build:

[('default', None, <class 'ResourceWarning'>, None, 0)]


Currently, only "-W options > PYTHONWARNINGS" goes into sys.warnoptions, whereas "BytesWarning > -X dev > default filters" is added by the warnings module ("init_filters()").

----------

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


More information about the Python-bugs-list mailing list