Skip to content

gh-133579: consistently report C curses function failures #134327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 27, 2025

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant

Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e113985
do not suppress errors in `PyCursesWindow_Dealloc`
picnixz May 19, 2025
953b4e8
do not suppress errors in `setcchar`
picnixz May 19, 2025
a474f30
do not suppress errors in `wattrset`
picnixz May 19, 2025
b8cc428
do not suppress errors in `wborder`
picnixz May 19, 2025
61f5e06
do not suppress errors in `box`
picnixz May 19, 2025
e618050
do not suppress errors in `touchline`
picnixz May 19, 2025
f492765
do not suppress errors in `getbkgd`
picnixz May 19, 2025
1928418
do not suppress errors in `mvwinch`
picnixz May 19, 2025
e917b9d
do not suppress errors in `wrefresh`
picnixz May 19, 2025
26d5ff4
add note for `wbkgdset`
picnixz May 20, 2025
5282d59
add note for `wenclose`
picnixz May 20, 2025
ac5f446
do not suppress errors in `unctrl`
picnixz May 20, 2025
debb159
add add note for `use_env`
picnixz May 20, 2025
29f2450
simplify logic in `assume_default_colors`
picnixz May 20, 2025
f0a5548
raise `PyExc_TypeError` instead of `curses.error` for invalid calls
picnixz May 20, 2025
8f3b1a2
check return codes in auto-generated functions
picnixz May 20, 2025
4a9cdb2
improve error report in delwin()
picnixz May 23, 2025
be1f360
remove useless comments
picnixz May 23, 2025
78976e8
Update Modules/_cursesmodule.c
picnixz May 24, 2025
a21b820
correctly use `PyErr_FormatUnraisable`
picnixz May 25, 2025
5eef99f
add NEWS entry
picnixz May 27, 2025
21cfc3a
Merge remote-tracking branch 'upstream/main' into fix/curses/more-err…
picnixz May 27, 2025
19201de
fixup refs
picnixz May 27, 2025
eb2670c
fixup
picnixz May 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Doc/howto/curses.rst
Original file line number Diff line number Diff line change
@@ -161,6 +161,8 @@ your terminal won't be left in a funny state on exception and you'll be
able to read the exception's message and traceback.


.. _windows-and-pads:

Windows and Pads
================

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:ref:`curses.window <curses-window-objects>`: Consistently report failures
of curses C API calls in Window methods by raising a :exc:`curses.error`.
This affects :meth:`~curses.window.addch`, :meth:`~curses.window.addnstr`,
:meth:`~curses.window.addstr`, :meth:`~curses.window.border`,
:meth:`~curses.window.box`, :meth:`~curses.window.chgat`,
:meth:`~curses.window.getbkgd`, :meth:`~curses.window.inch`,
:meth:`~curses.window.insstr` and :meth:`~curses.window.insnstr`.
Patch by Bénédikt Tran.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:meth:`curses.window.refresh` and :meth:`curses.window.noutrefresh` now raise
a :exc:`TypeError` instead of :exc:`curses.error` when called with an incorrect
number of arguments for :ref:`pads <windows-and-pads>`. Patch by Bénédikt Tran.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:mod:`curses`: Consistently report failures of curses C API calls in
module-level methods by raising a :exc:`curses.error`. This affects
:func:`~curses.assume_default_colors`, :func:`~curses.baudrate`,
:func:`~curses.cbreak`, :func:`~curses.echo`, :func:`~curses.longname`,
:func:`~curses.initscr`, :func:`~curses.nl`, :func:`~curses.raw`,
:func:`~curses.termattrs`, :func:`~curses.termname` and :func:`~curses.unctrl`.
Patch by Bénédikt Tran.
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant