@@ -290,6 +290,9 @@ def test_repr(self):
290290 self .assertEqual (repr (a0 ), "()" )
291291 self .assertEqual (repr (a2 ), "(0, 1, 2)" )
292292
293+ def _not_tracked_instantly (self , t ):
294+ self .assertFalse (gc .is_tracked (t ), t )
295+
293296 def _not_tracked (self , t ):
294297 # Nested tuples can take several collections to untrack
295298 gc .collect ()
@@ -307,13 +310,17 @@ def test_track_literals(self):
307310 # Test GC-optimization of tuple literals
308311 x , y , z = 1.5 , "a" , []
309312
310- self ._not_tracked (())
311- self ._not_tracked ((1 ,))
312- self ._not_tracked ((1 , 2 ))
313- self ._not_tracked ((1 , 2 , "a" ))
314- self ._not_tracked ((1 , 2 , (None , True , False , ()), int ))
315- self ._not_tracked ((object (),))
313+ self ._not_tracked_instantly (())
314+ self ._not_tracked_instantly ((1 ,))
315+ self ._not_tracked_instantly ((1 , 2 ))
316+ self ._not_tracked_instantly ((1 , 2 , "a" ))
317+ self ._not_tracked_instantly ((1 , 2 ) * 5 )
318+ self ._not_tracked_instantly ((12 , 10 ** 10 , 'a_' * 100 ))
319+ self ._not_tracked_instantly ((object (),))
320+
316321 self ._not_tracked (((1 , x ), y , (2 , 3 )))
322+ self ._not_tracked ((1 , 2 , (None , True , False , ()), int ))
323+ self ._not_tracked ((object (), ()))
317324
318325 # Tuples with mutable elements are always tracked, even if those
319326 # elements are not tracked right now.
@@ -343,6 +350,12 @@ def check_track_dynamic(self, tp, always_track):
343350 self ._tracked (tp (tuple ([obj ]) for obj in [x , y , z ]))
344351 self ._tracked (tuple (tp ([obj ]) for obj in [x , y , z ]))
345352
353+ t = tp ([1 , x , y , z ])
354+ self .assertEqual (type (t ), tp )
355+ self ._tracked (t )
356+ self .assertEqual (type (t [:]), tuple )
357+ self ._tracked (t [:])
358+
346359 @support .cpython_only
347360 def test_track_dynamic (self ):
348361 # Test GC-optimization of dynamically constructed tuples.
0 commit comments