STINNER Victor <victor.stin...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27535>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to