[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)
This commit is contained in:
Bénédikt Tran 2024-11-06 14:33:23 +01:00 committed by GitHub
parent 6a084b9d60
commit 6e9da38866
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -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.

View File

@ -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);
}