Message281179
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. |
|
Date |
User |
Action |
Args |
2016-11-18 23:22:13 | martin.panter | set | recipients:
+ martin.panter, vstinner, serhiy.storchaka, xiang.zhang |
2016-11-18 23:22:13 | martin.panter | set | messageid: <1479511333.85.0.408909250571.issue28688@psf.upfronthosting.co.za> |
2016-11-18 23:22:13 | martin.panter | link | issue28688 messages |
2016-11-18 23:22:13 | martin.panter | create | |
|