Martin Panter added the comment:

Here is another way to remember that the filter list has already been 
initialized. I made a new immortal _warnings.filters_initialized flag at the C 
level. It is actually a list so that it can be mutated and remembered across 
module reloads, but it is either empty (evaluates as false), or a single 
element: [True].

Also, Python 2 does get duplicated filters, but I guess there is not test that 
exposes it.

$ python2 -Wall
. . .
>>> import warnings
>>> len(warnings.filters)
5
>>> reload(warnings)
<module 'warnings' from '/usr/lib/python2.7/warnings.pyc'>
>>> len(warnings.filters)
6

I agree there is no need to change Python 2 at this stage.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28688>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to