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.

classification
Title: Re-importing _warnings changes warnings.filters
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder: test_warnings modifies warnings.filters when running with "-W default"
View: 18383
Assigned To: Nosy List: Arfrever, BreamoreBoy, brett.cannon, serhiy.storchaka
Priority: low Keywords:

Created on 2012-05-11 19:40 by brett.cannon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Issue14784.log BreamoreBoy, 2014-07-04 07:17 Test run output
Messages (3)
msg160446 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-05-11 19:40
If you run test.test_warnings it reports that warnings.filters changed. If you comment out the import of c_warnings in that module, the warning goes away (this happens with running on tests).

It looks like _PyWarnings_Init() itself doesn't trigger a reprocessing of the sys.warnoptions as an import of warnings.py does, and thus the change in warnings.filter.
msg222265 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-04 07:17
I've just tried this and didn't see anything about warnings.filters changed.  Full test run output in attached file.
msg232452 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-12-10 22:55
Issue18383 is a duplicate of this issue but it has a patch (not perfect).
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 58989
2016-04-13 02:32:56martin.pantersetstatus: open -> closed
superseder: test_warnings modifies warnings.filters when running with "-W default"
resolution: duplicate
2014-12-10 22:55:40serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg232452
2014-07-04 07:17:05BreamoreBoysetfiles: + Issue14784.log
nosy: + BreamoreBoy
messages: + msg222265

2012-05-12 17:13:47Arfreversetnosy: + Arfrever
2012-05-11 19:40:15brett.cannoncreate