diff options
author | Gregory P. Smith <greg@krypto.org> | 2023-05-24 04:15:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 04:15:49 (GMT) |
commit | 7f963bfc79a515dc9822ebddbfb1b5927d2dda09 (patch) | |
tree | f2612716f4e0fd18214f24a7a7f638fc53179f06 | |
parent | 2e0931046dcc200fd6abb2cdfaf57d8b99117c57 (diff) | |
download | cpython-7f963bfc79a515dc9822ebddbfb1b5927d2dda09.zip cpython-7f963bfc79a515dc9822ebddbfb1b5927d2dda09.tar.gz cpython-7f963bfc79a515dc9822ebddbfb1b5927d2dda09.tar.bz2 |
gh-104372: use == -1 before PyErr_Occurred (#104831)
The ideal pattern for this. (already in the 3.11 backport)
-rw-r--r-- | Modules/_posixsubprocess.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index 1b7fe71..6340379 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -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) { |