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 ggenellina
Recipients ggenellina
Date 2009-08-05.04:52:55
SpamBayes Score 5.936763e-10
Marked as misclassified No
Message-id <1249447980.99.0.321429613778.issue6647@psf.upfronthosting.co.za>
In-reply-to
Content
warnings.catch_warnings is a context manager supposed to save and 
restore warnings filters, and optionally record all warnings issued.

But it does so in a completely thread-unsafe way, by replacing the 
module's "showwarning" and "filters" attributes on enter, and restoring 
them on exit. If the __enter__ / __exit__ calls of two threads overlap, 
after leaving the last block the warnings state is not the same as the 
original state, as it should be.

I don't know how to fix this, other than using locks (that could block 
indefinitely) or severely restricting how catch_warnings may be used. 
At least, this issue should be documented.
History
Date User Action Args
2009-08-05 04:53:01ggenellinasetrecipients: + ggenellina
2009-08-05 04:53:00ggenellinasetmessageid: <1249447980.99.0.321429613778.issue6647@psf.upfronthosting.co.za>
2009-08-05 04:52:58ggenellinalinkissue6647 messages
2009-08-05 04:52:58ggenellinacreate