https://github.com/python/cpython/commit/6e9da38866e3990df440da63bbec39a90487e261
commit: 6e9da38866e3990df440da63bbec39a90487e261
branch: 3.13
author: Bénédikt Tran <[email protected]>
committer: vstinner <[email protected]>
date: 2024-11-06T14:33:23+01:00
summary:
[3.13] gh-126313: Fix a crash in curses.napms() due to incorrect error handling
(GH-126351) (#126493)
gh-126313: Fix a crash in curses.napms() due to incorrect error handling
(GH-126351)
files:
A Misc/NEWS.d/next/Library/2024-11-03-09-42-42.gh-issue-126313.EFP6Dl.rst
M Modules/_cursesmodule.c
diff --git
a/Misc/NEWS.d/next/Library/2024-11-03-09-42-42.gh-issue-126313.EFP6Dl.rst
b/Misc/NEWS.d/next/Library/2024-11-03-09-42-42.gh-issue-126313.EFP6Dl.rst
new file mode 100644
index 00000000000000..dad348d8898f13
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-11-03-09-42-42.gh-issue-126313.EFP6Dl.rst
@@ -0,0 +1,2 @@
+Fix an issue in :func:`curses.napms` when :func:`curses.initscr` has not yet
+been called. Patch by Bénédikt Tran.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index f926fa2f9c0093..55038cf09c2876 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -3688,7 +3688,10 @@ static int
_curses_napms_impl(PyObject *module, int ms)
/*[clinic end generated code: output=5f292a6a724491bd input=c6d6e01f2f1df9f7]*/
{
- PyCursesInitialised;
+ if (initialised != TRUE) {
+ PyErr_SetString(PyCursesError, "must call initscr() first");
+ return -1;
+ }
return napms(ms);
}
_______________________________________________
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]