Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
More error handling improvements
  • Loading branch information
mhsmith committed Nov 18, 2024
commit 8a026f13455b1f2c6bbc632ae5d3bf984aec0838
14 changes: 9 additions & 5 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -13569,15 +13569,19 @@ conv_confname(PyObject *module, PyObject *arg, int *valuep, const char *tablenam
Py_INCREF(arg); // Match the Py_DECREF below.
}

if (PyLong_Check(arg)) {
*valuep = PyLong_AsInt(arg);
} else {
int success = 0;
if (!PyLong_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"configuration names must be strings or integers");
} else {
int value = PyLong_AsInt(arg);
if (!(value == -1 && PyErr_Occurred())) {
*valuep = value;
success = 1;
}
}

Py_DECREF(arg);
return !PyErr_Occurred();
return success;
}


Expand Down