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 tseaver
Recipients benjamin.peterson, brett.cannon, exarkun, flox, mark.dickinson, pitrou, tseaver
Date 2010-04-30.02:39:12
SpamBayes Score 4.0259303e-07
Marked as misclassified No
Message-id <1272595155.16.0.764651452625.issue4180@psf.upfronthosting.co.za>
In-reply-to
Content
The attached patch fixes the OP's use case on the Python side by re-ordering the tests, such that "always" prevents the short-circuit from firing::

 $ ./python 
 Python 2.6.5+ (release26-maint, Apr 29 2010, 21:24:12) 
 [GCC 4.3.3] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import warnings as o_warnings
 >>> import sys
 >>> sys.modules['_warnings'] = 0
 >>> del sys.modules['warnings']
 >>> import warnings as py_warnings
 >>> def f():
 ...     py_warnings.warn('foo')
 ... 
 >>> f()
 __main__:2: UserWarning: foo
 >>> f()
 >>> py_warnings.simplefilter('always')
 >>> f()
 __main__:2: UserWarning: foo
 >>> f()
 __main__:2: UserWarning: foo
History
Date User Action Args
2010-04-30 02:39:15tseaversetrecipients: + tseaver, brett.cannon, exarkun, mark.dickinson, pitrou, benjamin.peterson, flox
2010-04-30 02:39:15tseaversetmessageid: <1272595155.16.0.764651452625.issue4180@psf.upfronthosting.co.za>
2010-04-30 02:39:13tseaverlinkissue4180 messages
2010-04-30 02:39:12tseavercreate