Skip to content

Commit 178b5b1

Browse files
[3.13] gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191) (#121208)
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 <[email protected]>
1 parent 1f2f9c4 commit 178b5b1

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

255259
# Clear caches

0 commit comments

Comments
 (0)