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