| 427 | |
| 428 | def test_trashcan(self): |
| 429 | class Ouch: |
| 430 | n = 0 |
| 431 | def __del__(self): |
| 432 | Ouch.n = Ouch.n + 1 |
| 433 | if Ouch.n % 17 == 0: |
| 434 | gc.collect() |
| 435 | |
| 436 | # "trashcan" is a hack to prevent stack overflow when deallocating |
| 437 | # very deeply nested tuples etc. It works in part by abusing the |
no outgoing calls
searching dependent graphs…