The curses module can serialize a single window with window.putwin() / curses.getwin(), but it has no way to dump and restore the whole screen. The four X/Open functions that do this are still missing:
scr_dump(filename) — write the current virtual screen to a file.
scr_restore(filename) — set the virtual screen to a dumped file; the next doupdate()/refresh() paints it.
scr_init(filename) — use a dump as the assumed current terminal contents (e.g. after another program drew the screen).
scr_set(filename) — combine scr_restore() and scr_init().
These are the whole-screen counterpart of putwin()/getwin(). Unlike those (which take a Python file object, mirroring C putwin(WINDOW *, FILE *)), the C scr_* functions are filename-based (they fopen internally), so the Python wrappers take a filename — a str or a path-like object.
Activity
gh-152260: Add curses.scr_dump(), scr_restore(), scr_init() and scr_s…
gh-152260: Fix test_scr_dump() on macOS (GH-152340)
StanFromIreland commented on Jun 27, 2026
Tests are still failing on CI, see #152376 (comment).
gh-152260: Fix flaky curses test_scr_dump on macOS (GH-152390)
serhiy-storchaka commented on Jun 28, 2026
Implemented in #152261 (merged), with a macOS test-determinism fix in #152390 (merged).