From: Victor Stinner Date: Mon, 1 Jul 2024 09:03:33 +0000 (+0200) Subject: gh-121084: Call _abc_registry_clear() when checking refleaks (#121191) X-Git-Tag: v3.14.0a1~1277 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c766ad206ea60b1e0edcb625b99e7631954a984f;p=thirdparty%2FPython%2Fcpython.git gh-121084: Call _abc_registry_clear() when checking refleaks (#121191) dash_R_cleanup() now calls _abc_registry_clear() before calling again register(). --- diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py index 25e713054029..20b05954c762 100644 --- a/Lib/test/libregrtest/refleak.py +++ b/Lib/test/libregrtest/refleak.py @@ -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