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 martin.panter
Recipients Thomas.Robitaille, martin.panter, mdk, ncoghlan, ned.deily, serhiy.storchaka, vstinner
Date 2016-12-06.02:53:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480992822.11.0.858302303004.issue28835@psf.upfronthosting.co.za>
In-reply-to
Content
Actually, I found a regression. Looks like you also need to cancel any showwarning() function set by the user:

>>> import warnings
>>> warnings.showwarning = print
>>> with warnings.catch_warnings(record=True) as recording:
...     warnings.warn("hi")  # Unpatched did not call print()
... 
hi <class 'UserWarning'> __main__ 2 None None
>>> recording  # Unpatched returned the warning here
[]

Also, should the documentation of catch_warnings() be amended to say that there is no longer a custom showwarning() function? The recording mechanism is now an internal detail, and not accessible by calling showwarning().
History
Date User Action Args
2016-12-06 02:53:42martin.pantersetrecipients: + martin.panter, ncoghlan, vstinner, ned.deily, serhiy.storchaka, Thomas.Robitaille, mdk
2016-12-06 02:53:42martin.pantersetmessageid: <1480992822.11.0.858302303004.issue28835@psf.upfronthosting.co.za>
2016-12-06 02:53:42martin.panterlinkissue28835 messages
2016-12-06 02:53:41martin.pantercreate