mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-27535: Fix memory leak with warnings ignore (#4489)
The warnings module doesn't leak memory anymore in the hidden warnings registry for the "ignore" action of warnings filters. The warn_explicit() function doesn't add the warning key to the registry anymore for the "ignore" action.
This commit is contained in:
parent
21c7730761
commit
c9758784eb
4 changed files with 14 additions and 5 deletions
|
@ -125,6 +125,7 @@ class FilterTests(BaseTest):
|
|||
self.module.filterwarnings("ignore", category=UserWarning)
|
||||
self.module.warn("FilterTests.test_ignore", UserWarning)
|
||||
self.assertEqual(len(w), 0)
|
||||
self.assertEqual(list(__warningregistry__), ['version'])
|
||||
|
||||
def test_ignore_after_default(self):
|
||||
with original_warnings.catch_warnings(record=True,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue