Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-121084: Fix test_typing random leaks #121360

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Lib/test/libregrtest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ def clear_caches():
for f in typing._cleanups:
f()

import inspect
abs_classes = filter(inspect.isabstract, typing.__dict__.values())
for abc in abs_classes:
for obj in abc.__subclasses__() + [abc]:
obj._abc_caches_clear()

try:
fractions = sys.modules['fractions']
except KeyError:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix test_typing random leaks. Clear typing ABC caches when running tests for
refleaks (``-R`` option): call ``_abc_caches_clear()`` on typing abstract
classes and their subclasses. Patch by Victor Stinner.
Loading