Bugs item #1191104, was opened at 2005-04-27 17:55 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1191104&group_id=5470
Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Ivan Vilata i Balaguer (ivilata) Assigned to: Nobody/Anonymous (nobody) Summary: Warning ``error`` filter action is ignored. Initial Comment: Hi all. It seems that setting the ``error`` action on a warning message once it has already been triggered does not allow it to be triggered again. As usual, the code is clearer than the explanation:: import warnings def do_warn(): warnings.warn("A warning.", DeprecationWarning) do_warn() warnings.filterwarnings('error', category=DeprecationWarning) do_warn() warnings.filterwarnings('always', category=DeprecationWarning) do_warn() The output of this program is:: nowarn.py:4: DeprecationWarning: A warning. warnings.warn("A warning.", DeprecationWarning) There is no exception raised, though the filter was instructed to turn the warning into an error. Take note that using ``always`` has similar results. Does it work in that way on purpose? I find it quite counterintuitive, IMHO. If this behaviour is intended, what would be the way to turn the second warning into an exception? Thanks! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1191104&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com