Message282493
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(). |
|
Date |
User |
Action |
Args |
2016-12-06 02:53:42 | martin.panter | set | recipients:
+ martin.panter, ncoghlan, vstinner, ned.deily, serhiy.storchaka, Thomas.Robitaille, mdk |
2016-12-06 02:53:42 | martin.panter | set | messageid: <1480992822.11.0.858302303004.issue28835@psf.upfronthosting.co.za> |
2016-12-06 02:53:42 | martin.panter | link | issue28835 messages |
2016-12-06 02:53:41 | martin.panter | create | |
|