Skip to content

Commit 7f963bf

Browse files
authored
gh-104372: use == -1 before PyErr_Occurred (#104831)
The ideal pattern for this. (already in the 3.11 backport)
1 parent 2e09310 commit 7f963bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/_posixsubprocess.c

+1-1
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)