Skip to content

Commit 7371547

Browse files
committed
Test direct marshal tuple reference loop
Assisted-by: Codex:gpt-5
1 parent 64d233f commit 7371547

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎Lib/test/test_marshal.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,13 @@ def test_loads_abnormal_reference_loops(self):
410410
self.assertIsInstance(a[0], dict)
411411
self.assertIs(a[0][None], a)
412412

413-
# Direct self-reference which cannot be created in Python.
414-
# This creates a reference loop which cannot be collected.
415-
if False:
416-
data = b'\xa8\x01\x00\x00\x00r\x00\x00\x00\x00' # (<R>,)
417-
a = marshal.loads(data)
418-
self.assertIsInstance(a, tuple)
419-
self.assertIs(a[0], a)
413+
# Direct self-reference which cannot be created in Python. CPython
414+
# leaves this disabled because its reference counting cannot collect
415+
# the resulting cycle; RustPython's tracing collector can.
416+
data = b'\xa8\x01\x00\x00\x00r\x00\x00\x00\x00' # (<R>,)
417+
a = marshal.loads(data)
418+
self.assertIsInstance(a, tuple)
419+
self.assertIs(a[0], a)
420420

421421
# Direct self-references which cannot be created in Python
422422
# because of unhashability.

0 commit comments

Comments
 (0)