]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121084: Call _abc_registry_clear() when checking refleaks (#121191)
authorVictor Stinner <vstinner@python.org>
Mon, 1 Jul 2024 09:03:33 +0000 (11:03 +0200)
committerGitHub <noreply@github.com>
Mon, 1 Jul 2024 09:03:33 +0000 (11:03 +0200)
dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().

Lib/test/libregrtest/refleak.py

index 25e7130540298530cb6b79b217b40369d7fae36f..20b05954c762ff8b03956dedfee91ec3566ac203 100644 (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