gh-104372: use == -1 before PyErr_Occurred (#104831)

The ideal pattern for this.  (already in the 3.11 backport)
This commit is contained in:
Gregory P. Smith 2023-05-23 21:15:49 -07:00 committed by GitHub
parent 2e0931046d
commit 7f963bfc79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -200,7 +200,7 @@ convert_fds_to_keep_to_c(PyObject *py_fds_to_keep, int *c_fds_to_keep)
for (i = 0; i < len; ++i) {
PyObject* fdobj = PyTuple_GET_ITEM(py_fds_to_keep, i);
long fd = PyLong_AsLong(fdobj);
if (PyErr_Occurred()) {
if (fd == -1 && PyErr_Occurred()) {
return -1;
}
if (fd < 0 || fd > INT_MAX) {