Message306773
| Author |
vstinner |
| Recipients |
Decorater, jbfzs, ncoghlan, r.david.murray, rhettinger, serhiy.storchaka, vstinner, Александр Карпинский |
| Date |
2017年11月23日.00:43:39 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1511397819.18.0.213398074469.issue27535@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
My PR 4502 implements all optimizations, but also converts warnings.filters to a tuple, to detect when detect attempts to modify directly warnings.filters, rather than using function calls.
Problem: test.libregrtest module uses a pattern like this:
old_filters = warnings.filters[:] # in function 1
(...)
warnings.filters[:] = old_filters # in function 2
While this pattern is perfectly fine when filters is a list, "warnings.filters[:] = old_filters" fails since a tuple is immutable.
Again, the question is if it's ok to break such code. I'm no more sure that catch_warnings() handles completly this use case, and a context manager is not convenient in the specific case of test.libregrest. |
|