Skip to content

Commit 46b48ff

Browse files
[3.15] gh-144067: Document terminal leak when initscr() follows setupterm() (GH-152624) (GH-152894)
(cherry picked from commit e471712) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent bd86f3c commit 46b48ff

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
@@ -324,6 +324,8 @@ The module :mod:`!curses` defines the following functions:
324324
Initialize the library. Return a :ref:`window <curses-window-objects>` object
325325
which represents the whole screen.
326326

327+
See :func:`setupterm` for a caveat about calling it before this function.
328+
327329
.. note::
328330

329331
If there is an error opening the terminal, the underlying curses library may
@@ -593,6 +595,13 @@ The module :mod:`!curses` defines the following functions:
593595
terminfo database entry could not be read. If the terminal has already
594596
been initialized, this function has no effect.
595597

598+
.. note::
599+
600+
Calling :func:`initscr` after :func:`setupterm`
601+
leaks the terminal that :func:`setupterm` allocated:
602+
the curses library keeps only a single current terminal
603+
and does not free the previously allocated one.
604+
596605

597606
.. function:: start_color()
598607

0 commit comments

Comments
 (0)