Skip to content

Commit

Permalink
pythongh-121084: Call _abc_registry_clear() when checking refleaks
Browse files Browse the repository at this point in the history
dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().
  • Loading branch information
vstinner committed Jun 30, 2024
1 parent c3677be commit 8ff48ca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Lib/test/libregrtest/refleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,12 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
abs_classes = filter(isabstract, abs_classes)
for abc in abs_classes:
for obj in abc.__subclasses__() + [abc]:
for ref in abcs.get(obj, set()):
if ref() is not None:
obj.register(ref())
refs = abcs.get(obj, None)
if refs is not None:
obj._abc_registry_clear()
for ref in refs:
if ref() is not None:
obj.register(ref())
obj._abc_caches_clear()

# Clear caches
Expand Down

0 comments on commit 8ff48ca

Please sign in to comment.