From 3bad678e5f1866fa82b5a5f3391fa287eb3c4ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sun, 3 Nov 2024 09:42:58 +0100 Subject: [PATCH 1/2] fix a crash in `curses.napms` --- Modules/_cursesmodule.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 27d5df08de933e..040ffa81153ebe 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -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); } From c45f186c8870c0f21b796a0e339cab08a0cabd2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sun, 3 Nov 2024 09:43:01 +0100 Subject: [PATCH 2/2] blurb --- .../next/Library/2024-11-03-09-42-42.gh-issue-126313.EFP6Dl.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2024-11-03-09-42-42.gh-issue-126313.EFP6Dl.rst 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.