Skip to content

Commit bf01d4c

Browse files
committed
add test
1 parent d279067 commit bf01d4c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Lib/test/test_structseq.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import copy
2+
import gc
23
import os
34
import pickle
45
import re
@@ -355,6 +356,14 @@ def test_reference_cycle(self):
355356
type(t).refcyle = t
356357
"""))
357358

359+
def test_replace_gc_tracked(self):
360+
# Verify that __replace__ results are properly GC-tracked
361+
time_struct= time.gmtime(0)
362+
lst = []
363+
replaced_struct = time_struct.__replace__(tm_year=lst)
364+
lst.append(replaced_struct)
365+
366+
self.assertTrue(gc.is_tracked(replaced_struct))
358367

359368
if __name__ == "__main__":
360369
unittest.main()

0 commit comments

Comments
 (0)