[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2021-04-02 Thread Tom Aldcroft
Tom Aldcroft added the comment: I encountered this issue today and want to +1 getting some attention on this. The disconnected nature of this issue makes it especially difficult to understand -- any package in the stack can change this hidden global variable `_filters_version` in the

[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2018-07-10 Thread Segev Finer
Change by Segev Finer : -- keywords: +patch pull_requests: +7769 stage: -> patch review ___ Python tracker ___ ___

[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2018-07-10 Thread Erik Bray
Erik Bray added the comment: Yes, I think `catch_warnings` should back up and restore the relevant `__warningregistry__`. At which point it's not even clear to me what value there is in the _filter_version... -- ___ Python tracker

[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2018-07-10 Thread Segev Finer
Segev Finer added the comment: Hmm, I originally missed the per module __warningregistry__... Need to read the code more closely... What should the behavior be? We can add a flag that will make all warning actions be "always" when catch_warnings is in effect. But that doesn't feel right

[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2018-06-28 Thread Erik Bray
Erik Bray added the comment: I just encountered this as well. The way catch_warnings is implemented is a bit "dumb" in how it treats _filter_version (it calls _filters_mutated even if the active filters are not actually changed when entering catch_warnings). More significantly,

[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2017-07-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +pitrou, serhiy.storchaka ___ Python tracker ___

[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2017-07-21 Thread Segev Finer
Segev Finer added the comment: I think you will need to save and restore _filters_version and _onceregistry. Since _filters_version is a static variable in _warnings.c you will probably also have to modify it somehow to make it accessible to warnings.py. -- components: +Library (Lib)

[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting

2017-07-18 Thread Gerrit Holl
Changes by Gerrit Holl : -- title: `catch_warnings` context manager should reset warning registry to previous state upon exiting, to prevent warnings from being reprinted -> `catch_warnings` context manager causes all warnings to be printed every time, even