Skip to content

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

Merged
picnixz merged 24 commits into
python:mainfrom
picnixz:fix/curses/more-error-reports-133579
May 27, 2025
Merged

gh-133579: consistently report C curses function failures#134327
picnixz merged 24 commits into
python:mainfrom
picnixz:fix/curses/more-error-reports-133579

Conversation

@picnixz

@picnixzpicnixz commented May 20, 2025

Copy link
Copy Markdown
Member

Comment threadModules/_cursesmodule.c Outdated
Comment threadModules/_cursesmodule.c Outdated
Comment threadModules/_cursesmodule.c Outdated
@picnixz

Copy link
Copy Markdown
MemberAuthor

I've removed useless comments because I think it'll only confuse readers.

@picnixz
picnixz requested a review from vstinnerMay 23, 2025 12:31
Comment threadModules/_cursesmodule.c
Comment threadModules/_cursesmodule.c Outdated
picnixzand others added 2 commits May 24, 2025 23:44
Co-authored-by: Victor Stinner <vstinner@python.org>

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please add a NEWS entry. You should document that some functions can now fail and that the exception type changed in some existing error handling code paths.

@picnixz
picnixz enabled auto-merge (squash) May 27, 2025 09:55
@picnixz
picnixz disabled auto-merge May 27, 2025 09:55
@picnixz
picnixz enabled auto-merge (squash) May 27, 2025 09:57
@picnixz
picnixz merged commit 30dde1e into python:mainMay 27, 2025
@picnixz
picnixz deleted the fix/curses/more-error-reports-133579 branch May 30, 2025 13:52
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…on#134327)
Some curses module-level functions and window methods now raise
a `curses.error` when a call to a C curses function fails:
- Module-level functions: assume_default_colors, baudrate, cbreak,
echo, longname, initscr, nl, raw, termattrs, termname, and unctrl.
- Window methods: addch, addnstr, addstr, border, box, chgat,
getbkgd, inch, insstr, and insnstr.
In addition, `curses.window.refresh` and `curses.window.noutrefresh`
now raise a `TypeError` instead of a `curses.error` when called with an
incorrect number of arguments for pads.
See also ee36db5 for similar
changes.
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…on#134327)
Some curses module-level functions and window methods now raise
a `curses.error` when a call to a C curses function fails:
- Module-level functions: assume_default_colors, baudrate, cbreak,
echo, longname, initscr, nl, raw, termattrs, termname, and unctrl.
- Window methods: addch, addnstr, addstr, border, box, chgat,
getbkgd, inch, insstr, and insnstr.
In addition, `curses.window.refresh` and `curses.window.noutrefresh`
now raise a `TypeError` instead of a `curses.error` when called with an
incorrect number of arguments for pads.
See also ee36db5 for similar
changes.
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
…on#134327)
Some curses module-level functions and window methods now raise
a `curses.error` when a call to a C curses function fails:
- Module-level functions: assume_default_colors, baudrate, cbreak,
echo, longname, initscr, nl, raw, termattrs, termname, and unctrl.
- Window methods: addch, addnstr, addstr, border, box, chgat,
getbkgd, inch, insstr, and insnstr.
In addition, `curses.window.refresh` and `curses.window.noutrefresh`
now raise a `TypeError` instead of a `curses.error` when called with an
incorrect number of arguments for pads.
See also ee36db5 for similar
changes.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@picnixz@vstinner