| 431 | |
| 432 | def test_trashcan(self): |
| 433 | class Ouch: |
| 434 | n = 0 |
| 435 | def __del__(self): |
| 436 | Ouch.n = Ouch.n + 1 |
| 437 | if Ouch.n % 17 == 0: |
| 438 | gc.collect() |
| 439 | |
| 440 | # "trashcan" is a hack to prevent stack overflow when deallocating |
| 441 | # very deeply nested tuples etc. It works in part by abusing the |