This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients martin.panter, serhiy.storchaka, vstinner, xiang.zhang
Date 2016-11-18.23:22:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479511333.85.0.408909250571.issue28688@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-11-18 23:22:13martin.pantersetrecipients: + martin.panter, vstinner, serhiy.storchaka, xiang.zhang
2016-11-18 23:22:13martin.pantersetmessageid: <1479511333.85.0.408909250571.issue28688@psf.upfronthosting.co.za>
2016-11-18 23:22:13martin.panterlinkissue28688 messages
2016-11-18 23:22:13martin.pantercreate