Bugs item #1548371, was opened at 2006-08-29 09:27 Message generated for change (Comment added) made by marienz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548371&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Roger Upole (rupole) Assigned to: Nobody/Anonymous (nobody) Summary: filterwarnings('error') has no effect Initial Comment: Once a warning has already been issued, warnings.filterwarnings('error',...) will not cause an error to be raised. When the attached script is run, the warning is printed the first time thru the loop, but no error is raised the 2nd time thru. Likewise, warnings.filterwarnings('always',...) will not cause the warning to be printed again. ---------------------------------------------------------------------- Comment By: Marien Zwart (marienz) Date: 2006-08-31 22:34 Message: Logged In: YES user_id=857292 This is caused by the warnings module caching when a combination of message, Warning subclass and linenumber gets ignored and bypassing the search through the warning filters when that same combination occurs again. I think it is possible to avoid this problem while keeping the cache by keeping track of the "version" of the filters list (a simple integer that is incremented every time the filters list is modified through the functions in the warnings module) and including this in the key tuple warn_explicit uses to remember previous ignores. Old stuff would remain in the cache but that should not be a big problem (changes to the filters list should not be that common). Does this sound reasonable? If it does I'll see if I can produce a patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548371&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com