You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CPython's _curses module does not expose the complete core curses API.
Several bindings are missing or incomplete compared with the underlying
ncurses interface.
The missing functionality includes terminal and termcap operations,
video operations, soft-label operations, mcprint(), and ripoffline(). Some related curses functionality is already present in
the current development branch but needs to be completed and integrated
consistently with the current stateful module architecture.
This issue intentionally concerns the core curses API only. The curses
form and menu APIs are separate and are not part of this issue.
Proposed solution
Port the remaining core curses bindings using the current CPython
module-state and Argument Clinic conventions, and add the corresponding
tests and documentation.
Thank you for your interest in curses, but the module is not stagnant. It was significantly extended in 3.16 and now covers almost the full curses API: multiple screens (newterm(), set_term()), Unicode text and combining characters (complexchar and complexstr), extended colors and color pairs, WA_* attributes, soft-label keys, more mouse and key-management functions, and many of the smaller missing functions. See the curses section of "What's New in Python 3.16".
The remaining functions are missing not by accident:
tgetent(), tgetflag(), tgetnum(), tgetstr() and tgoto() are the obsolete termcap interface. Their terminfo equivalents tigetflag(), tigetnum(), tigetstr() and tparm() are already available. Also, tgetent() calls setupterm() internally and replaces the current terminal.
vidattr(), vidputs() and tputs() write directly to the terminal, bypassing the curses screen, so curses loses track of the actual attributes. Programs that work at the terminfo level can use tparm() and putp().
mcprint() sends data to a printer attached to the terminal, which is hardly useful today.
ripoffline() needs a careful design: the C callback has no user data and is called inside initscr() or newterm(), where exceptions cannot be propagated, and the window it receives is owned by curses and must not be deleted by Python. There is also an ncurses bug that makes it unsafe with multiple screens (https://lists.gnu.org/archive/html/bug-ncurses/2026-10/msg00009.html). The implementation in gh-160141: Curses core fixes #160142 deletes that window as soon as the callback returns, which leads to a use-after-free.
The menu and form libraries are tracked in #44985. I have four alternative prototypes for both of them (a direct C binding, a pure Python implementation, and two more Pythonic APIs), but they are large, and their memory ownership rules do not map well to Python, so the choice between them needs a design discussion first.
If you have a concrete use case for any of these functions, please describe it here, and we can discuss what API would fit.
Activity
gvanrossum commentedon Oct 21, 2026
@serhiy-storchaka Is this is your wheelhouse?
picnixz commentedon Oct 21, 2026
Unless Serhiy supports this addition, please do not open a PR.
pythongh-160141: Complete core curses bindings
serhiy-storchaka commentedon Oct 22, 2026
Thank you for your interest in curses, but the module is not stagnant. It was significantly extended in 3.16 and now covers almost the full curses API: multiple screens (
newterm(),set_term()), Unicode text and combining characters (complexcharandcomplexstr), extended colors and color pairs,WA_*attributes, soft-label keys, more mouse and key-management functions, and many of the smaller missing functions. See the curses section of "What's New in Python 3.16".The remaining functions are missing not by accident:
tgetent(),tgetflag(),tgetnum(),tgetstr()andtgoto()are the obsolete termcap interface. Their terminfo equivalentstigetflag(),tigetnum(),tigetstr()andtparm()are already available. Also,tgetent()callssetupterm()internally and replaces the current terminal.vidattr(),vidputs()andtputs()write directly to the terminal, bypassing the curses screen, so curses loses track of the actual attributes. Programs that work at the terminfo level can usetparm()andputp().mcprint()sends data to a printer attached to the terminal, which is hardly useful today.ripoffline()needs a careful design: the C callback has no user data and is called insideinitscr()ornewterm(), where exceptions cannot be propagated, and the window it receives is owned by curses and must not be deleted by Python. There is also an ncurses bug that makes it unsafe with multiple screens (https://lists.gnu.org/archive/html/bug-ncurses/2026-10/msg00009.html). The implementation in gh-160141: Curses core fixes #160142 deletes that window as soon as the callback returns, which leads to a use-after-free.The menu and form libraries are tracked in #44985. I have four alternative prototypes for both of them (a direct C binding, a pure Python implementation, and two more Pythonic APIs), but they are large, and their memory ownership rules do not map well to Python, so the choice between them needs a design discussion first.
If you have a concrete use case for any of these functions, please describe it here, and we can discuss what API would fit.