Skip to content

Commit b719dd8

Browse files
[3.12] gh-104372: use == -1 before PyErr_Occurred (GH-104831) (#104833)
gh-104372: use == -1 before PyErr_Occurred (GH-104831) The ideal pattern for this. (already in the 3.11 backport) (cherry picked from commit 7f963bf) Co-authored-by: Gregory P. Smith <[email protected]>
1 parent 22c45c4 commit b719dd8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/_posixsubprocess.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ convert_fds_to_keep_to_c(PyObject *py_fds_to_keep, int *c_fds_to_keep)
200200
for (i = 0; i < len; ++i) {
201201
PyObject* fdobj = PyTuple_GET_ITEM(py_fds_to_keep, i);
202202
long fd = PyLong_AsLong(fdobj);
203-
if (PyErr_Occurred()) {
203+
if (fd == -1 && PyErr_Occurred()) {
204204
return -1;
205205
}
206206
if (fd < 0 || fd > INT_MAX) {

0 commit comments

Comments
 (0)