Commit 6fb6465
Add screen.close() to break the screen/window reference cycle
A screen and its standard window reference each other, so a screen is only
reclaimed by the cyclic garbage collector. screen.close() detaches the
standard window -- clearing the cycle and the window so its delwin() is
skipped (delscreen() frees it instead) -- letting the screen be released by
reference counting. Afterwards screen.stdscr is None and the old window
raises curses.error.
Use it in the tests instead of an explicit gc.collect().
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 03f0d8c commit 6fb6465
3 files changed
Lines changed: 49 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
1465 | 1479 | | |
1466 | 1480 | | |
1467 | 1481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
1869 | 1870 | | |
1870 | 1871 | | |
1871 | 1872 | | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
1872 | 1886 | | |
1873 | 1887 | | |
1874 | 1888 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3339 | 3339 | | |
3340 | 3340 | | |
3341 | 3341 | | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
3342 | 3356 | | |
| 3357 | + | |
| 3358 | + | |
3343 | 3359 | | |
3344 | 3360 | | |
3345 | 3361 | | |
| |||
0 commit comments