[issue18383] test_warnings modifies warnings.filters when running with "-W default"

Florent Xicluna report at bugs.python.org
Sat Jul 6 15:56:53 CEST 2013


Florent Xicluna added the comment:

Much simpler:

$ ./python -Wd

import warnings
import sys
saved = warnings.filters.copy()

del sys.modules['warnings']
import warnings

assert warnings.filters != saved
assert warnings.filters.pop(0) = warnings.filters[0]
assert warnings.filters == saved

Explanation: the "default" filter is duplicated on each reload of the warnings module.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18383>
_______________________________________


More information about the Python-bugs-list mailing list