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 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.
History
Date User Action Args
2017-11-23 00:43:39vstinnersetrecipients: + vstinner, rhettinger, ncoghlan, r.david.murray, serhiy.storchaka, Decorater, Александр Карпинский, jbfzs
2017-11-23 00:43:39vstinnersetmessageid: <1511397819.18.0.213398074469.issue27535@psf.upfronthosting.co.za>
2017-11-23 00:43:39vstinnerlinkissue27535 messages
2017-11-23 00:43:39vstinnercreate