gh-121084: Call _abc_registry_clear() when checking refleaks (#121191)

dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().
This commit is contained in:
Victor Stinner 2024-07-01 11:03:33 +02:00 committed by GitHub
parent 6988ff02a5
commit c766ad206e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -246,9 +246,13 @@ 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:
subclass = ref()
if subclass is not None:
obj.register(subclass)
obj._abc_caches_clear()
# Clear caches