@@ -290,15 +290,18 @@ def test_repr(self):
290290 self .assertEqual (repr (a0 ), "()" )
291291 self .assertEqual (repr (a2 ), "(0, 1, 2)" )
292292
293+ # Checks that t is not tracked without any GC collections.
293294 def _not_tracked_instantly (self , t ):
294295 self .assertFalse (gc .is_tracked (t ), t )
295296
297+ # Checks that t is not tracked after GC collection.
296298 def _not_tracked (self , t ):
297299 # Nested tuples can take several collections to untrack
298300 gc .collect ()
299301 gc .collect ()
300302 self .assertFalse (gc .is_tracked (t ), t )
301303
304+ # Checks that t continues to be tracked even after GC collection.
302305 def _tracked (self , t ):
303306 self .assertTrue (gc .is_tracked (t ), t )
304307 gc .collect ()
@@ -310,6 +313,8 @@ def test_track_literals(self):
310313 # Test GC-optimization of tuple literals
311314 x , y , z = 1.5 , "a" , []
312315
316+ # We check that those objects aren't tracked at all.
317+ # It's essential for the GC performance, see gh-139951.
313318 self ._not_tracked_instantly (())
314319 self ._not_tracked_instantly ((1 ,))
315320 self ._not_tracked_instantly ((1 , 2 ))
0 commit comments