You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The abort happens on normal and no-gil debug builds, release builds also hit the SystemError.
importcursescurses.napms(37)
Error is:
Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set
Python runtime state: initialized
_curses.error: must call initscr() first
The above exception was the direct cause of the following exception:
SystemError: <built-in function napms> returned a result with an exception set
Current thread 0x00007fe41a8c3740 (most recent call first):
File "/home/fusil/python-73/curses-fatal/source.py", line 3 in <module>
Aborted
Ah I can see what happened. The macro returns 0 so that it can be used as a substitute for NULL in most of the functions it's being used but _curses.napms returns an int. Instead, it should return -1. It's an easy fix (one should simply remove the macro usage for this one and do something like that:
if (!_PyCursesStatefulCheckFunction(module,
curses_initscr_called,
"initscr")) {
return-1;
}
I think it should suffice. I won't make a PR on Saturday (UTC+2) but probably on Sunday.
Update: No need for a 3.12 backport because the implementation returns a PyObject * instead of an int. Only a 3.13 backport is needed (which I am taking care of now).
Activity
picnixz commentedon Nov 2, 2024
Ah I can see what happened. The macro returns 0 so that it can be used as a substitute for NULL in most of the functions it's being used but
_curses.napmsreturns an int. Instead, it should return -1. It's an easy fix (one should simply remove the macro usage for this one and do something like that:I think it should suffice. I won't make a PR on Saturday (UTC+2) but probably on Sunday.
[-]`curses.napms(37)` aborts with a `SystemError`[/-][+]`curses.napms()` aborts with a `SystemError`[/+]gh-126313: Fix a crash in curses.napms() due to incorrect error handl…
vstinner commentedon Nov 4, 2024
Fixed by change 19d9358.
serhiy-storchaka commentedon Nov 4, 2024
The fix was not backported yet.
picnixz commentedon Nov 6, 2024
Update: No need for a 3.12 backport because the implementation returns a
PyObject *instead of anint. Only a 3.13 backport is needed (which I am taking care of now).pythongh-126313: Fix a crash in curses.napms() due to incorrect error…
[3.13] gh-126313: Fix a crash in curses.napms() due to incorrect erro…
vstinner commentedon Nov 6, 2024
I merged the 3.13 backport.
pythongh-126313: Fix a crash in curses.napms() due to incorrect error…
pythongh-126313: Fix a crash in curses.napms() due to incorrect error…