()
| 67 | |
| 68 | |
| 69 | def _finalizes_on_last_reference() -> bool: |
| 70 | # Only a refcounting collector runs __del__ the moment the last reference goes; a tracing one defers it. |
| 71 | finalized: list[bool] = [] |
| 72 | |
| 73 | class Probe: |
| 74 | def __del__(self) -> None: |
| 75 | finalized.append(True) |
| 76 | |
| 77 | Probe() |
| 78 | return bool(finalized) |
| 79 | |
| 80 | |
| 81 | def _finalizes_on_collection() -> bool: |