8000 [3.12] gh-121084: Call _abc_registry_clear() when checking refleaks (… · python/cpython@3fba86e · GitHub
[go: up one dir, main page]

Skip to content

Commit 3fba86e

Browse files
[3.12] gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191) (#121209)
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 c766ad2) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent b80edaf commit 3fba86e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/libregrtest/refleak.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,13 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
239239
abs_classes = filter(isabstract, abs_classes)
240240
for abc in abs_classes:
241241
for obj in abc.__subclasses__() + [abc]:
242-
for ref in abcs.get(obj, set()):
243-
if ref() is not None:
244-
obj.register(ref())
242+
refs = abcs.get(obj, None)
243+
if refs is not None:
244+
obj._abc_registry_clear()
245+
for ref in refs:
246+
subclass = ref()
247+
if subclass is not None:
248+
obj.register(subclass)
245249
obj._abc_caches_clear()
246250

247251
# Clear caches

0 commit comments

Comments
 (0)
0