"""gc.get_referrers() can be used to see objects before they are fully built.Note that this is only an example. There are many ways to crash Pythonby using gc.get_referrers(), as well as many extension modules (evenwhen they are using perfectly documented patterns to build objects).Identifying and removing all places that expose to the GC apartially-built object is a long-term project. A patch was proposed onSF specifically for this example but I consider fixing just this singleexample a bit pointless (#1517042).A fix would include a whole-scale code review, possibly with an APIchange to decouple object creation and GC registration, and accordingfixes to the documentation for extension module writers. It's unlikelyto happen, though. So this is currently classified as"gc.get_referrers() is dangerous, use only for debugging"."""importgcdefg():marker=object()yieldmarker# now the marker is in the tuple being constructed[tup]=[xforxingc.get_referrers(marker)iftype(x)istuple]