Create a reference cycle with multiple __del__ methods. An object in a reference cycle will never have zero references, and so must be garbage collected. If one or more objects in the cycle have __del__ methods, the gc refuses to guess an order, and leaves the cycle uncollected.
| 65 | |
| 66 | @with_tp_del |
| 67 | class Uncollectable(object): |
| 68 | """Create a reference cycle with multiple __del__ methods. |
| 69 | |
| 70 | An object in a reference cycle will never have zero references, |
| 71 | and so must be garbage collected. If one or more objects in the |
| 72 | cycle have __del__ methods, the gc refuses to guess an order, |
| 73 | and leaves the cycle uncollected.""" |
| 74 | def __init__(self, partner=None): |
| 75 | if partner is None: |
| 76 | self.partner = Uncollectable(partner=self) |
| 77 | else: |
| 78 | self.partner = partner |
| 79 | def __tp_del__(self): |
| 80 | pass |
| 81 | |
| 82 | if sysconfig.get_config_vars().get('PY_CFLAGS', ''): |
| 83 | BUILD_WITH_NDEBUG = ('-DNDEBUG' in sysconfig.get_config_vars()['PY_CFLAGS']) |
no outgoing calls
searching dependent graphs…