gh-125843: fix test_curses.test_attributes
on x86-64 macOS (#134252)
While some `libcurses` functions are meant to return OK on success, this is not always the case for all implementations. As such, we relax the checks on the return values and allow any non-ERR value to be considered equivalent to OK.
This commit is contained in:
parent
28625d4f95
commit
e007e62ba7
@ -392,9 +392,9 @@ _PyCursesStatefulCheckFunction(PyObject *module,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return None if 'code' is OK. Otherwise, set an exception
|
* Return None if 'code' is different from ERR (implementation-defined).
|
||||||
* using curses_set_error() and the remaining arguments, and
|
* Otherwise, set an exception using curses_set_error() and the remaining
|
||||||
* return NULL.
|
* arguments, and return NULL.
|
||||||
*/
|
*/
|
||||||
static PyObject *
|
static PyObject *
|
||||||
curses_check_err(PyObject *module, int code,
|
curses_check_err(PyObject *module, int code,
|
||||||
@ -402,7 +402,6 @@ curses_check_err(PyObject *module, int code,
|
|||||||
const char *python_funcname)
|
const char *python_funcname)
|
||||||
{
|
{
|
||||||
if (code != ERR) {
|
if (code != ERR) {
|
||||||
assert(code == OK);
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
curses_set_error(module, curses_funcname, python_funcname);
|
curses_set_error(module, curses_funcname, python_funcname);
|
||||||
@ -416,7 +415,6 @@ curses_window_check_err(PyCursesWindowObject *win, int code,
|
|||||||
const char *python_funcname)
|
const char *python_funcname)
|
||||||
{
|
{
|
||||||
if (code != ERR) {
|
if (code != ERR) {
|
||||||
assert(code == OK);
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
curses_window_set_error(win, curses_funcname, python_funcname);
|
curses_window_set_error(win, curses_funcname, python_funcname);
|
||||||
@ -1580,7 +1578,7 @@ _curses_window_derwin_impl(PyCursesWindowObject *self, int group_left_1,
|
|||||||
win = derwin(self->win,nlines,ncols,begin_y,begin_x);
|
win = derwin(self->win,nlines,ncols,begin_y,begin_x);
|
||||||
|
|
||||||
if (win == NULL) {
|
if (win == NULL) {
|
||||||
curses_window_set_error(self, "derwin", NULL);
|
curses_window_set_null_error(self, "derwin", NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user