Skip to content

Commit 24eb30b

Browse files
serhiy-storchakaclaude
authored andcommitted
[3.15] gh-144067: Document terminal leak when initscr() follows setupterm() (GH-152624) (GH-152894)
(cherry picked from commit e471712) (cherry picked from commit 46b48ff) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0d3a87f commit 24eb30b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Doc/library/curses.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ The module :mod:`curses` defines the following functions:
306306
Initialize the library. Return a :ref:`window <curses-window-objects>` object
307307
which represents the whole screen.
308308

309+
See :func:`setupterm` for a caveat about calling it before this function.
310+
309311
.. note::
310312

311313
If there is an error opening the terminal, the underlying curses library may
@@ -568,6 +570,13 @@ The module :mod:`curses` defines the following functions:
568570
terminfo database entry could not be read. If the terminal has already
569571
been initialized, this function has no effect.
570572

573+
.. note::
574+
575+
Calling :func:`initscr` after :func:`setupterm`
576+
leaks the terminal that :func:`setupterm` allocated:
577+
the curses library keeps only a single current terminal
578+
and does not free the previously allocated one.
579+
571580

572581
.. function:: start_color()
573582

0 commit comments

Comments
 (0)