https://github.com/python/cpython/commit/4951a11ec0fa45981f87609f653c59d224f09df7
commit: 4951a11ec0fa45981f87609f653c59d224f09df7
branch: 3.15
author: Serhiy Storchaka <[email protected]>
committer: hugovk <[email protected]>
date: 2026-08-27T15:50:46+03:00
summary:

[3.15] gh-154139: Document that curses is not thread-safe (GH-154173) (#155690)

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

files:
M Doc/library/curses.rst

diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst
index 993cfe62f2ac00..d1545a188f25b2 100644
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -31,6 +31,18 @@ Linux and the BSD variants of Unix.
    Whenever the documentation mentions a *character string* it can be specified
    as a Unicode string or a byte string.
 
+.. note::
+
+   Whether curses may be used from several threads
+   depends on the underlying library and how it was built.
+   In many implementations, including the default build of ncurses,
+   the screen state is shared and not thread-safe;
+   since the blocking and refresh methods
+   (such as :meth:`~window.getch` and :meth:`~window.refresh`)
+   release the :term:`GIL`,
+   unsynchronized use from several threads can then crash the interpreter.
+   Serialize the calls.
+
 .. seealso::
 
    Module :mod:`curses.ascii`

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to