Skip to content

Commit c766ad2

Browse files
authored
gh-121084: Call _abc_registry_clear() when checking refleaks (#121191)
dash_R_cleanup() now calls _abc_registry_clear() before calling again register().
1 parent 6988ff0 commit c766ad2

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
@@ -246,9 +246,13 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
246246
abs_classes = filter(isabstract, abs_classes)
247247
for abc in abs_classes:
248248
for obj in abc.__subclasses__() + [abc]:
249-
for ref in abcs.get(obj, set()):
250-
if ref() is not None:
251-
obj.register(ref())
249+
refs = abcs.get(obj, None)
250+
if refs is not None:
251+
obj._abc_registry_clear()
252+
for ref in refs:
253+
subclass = ref()
254+
if subclass is not None:
255+
obj.register(subclass)
252256
obj._abc_caches_clear()
253257

254258
# Clear caches

0 commit comments

Comments
 (0)