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-03 16:08:34 +01:00 committed by GitHub
parent dcae5cd6ab
commit 19d9358437
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 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

@ -3815,8 +3815,11 @@ static int
_curses_napms_impl(PyObject *module, int ms)
/*[clinic end generated code: output=5f292a6a724491bd input=c6d6e01f2f1df9f7]*/
{
PyCursesStatefulInitialised(module);
if (!_PyCursesStatefulCheckFunction(module,
curses_initscr_called,
"initscr")) {
return -1;
}
return napms(ms);
}