]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 1 Jul 2024 09:29:23 +0000 (11:29 +0200)
committerGitHub <noreply@github.com>
Mon, 1 Jul 2024 09:29:23 +0000 (09:29 +0000)
gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191)

dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().
(cherry picked from commit c766ad206ea60b1e0edcb625b99e7631954a984f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/libregrtest/refleak.py

index a257d1023537b9868bae60d1ef53dc6767ad9c76..568690bdec4b90d6a50db1695a8b3204a3054914 100644 (file)
@@ -239,9 +239,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