CPython uses two garbage collection mechanisms. One of them is reference counting, which affects all objects, but which cannot clear objects that (directly or indirectly) relate to each other. What happens with the actual garbage collector: python has a module gcthat looks for circular references in objects that it knows about. Only objects that could potentially be part of the reference loop should worry about participating in a cyclic gc. So, for example, lists do, but there is no line; strings do not refer to any other objects. (Actually, the story is a little more complicated, as there are two ways to participate in the cyclic gc, but in reality this is not so important.)
Python ( ) gc. , C, , . , , . , gc , .
, Python (obmalloc), , . Python , ( ), : CPython , .