Skip to content

Commit

Permalink
pythongh-104372: use == -1 before PyErr_Occurred (python#104831)
Browse files Browse the repository at this point in the history
The ideal pattern for this.  (already in the 3.11 backport)
  • Loading branch information
gpshead committed May 24, 2023
1 parent 2e09310 commit 7f963bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Modules/_posixsubprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7f963bf

Please sign in to comment.