mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[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 7f963bfc79
)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
22c45c49bb
commit
b719dd8725
1 changed files with 1 additions and 1 deletions
|
@ -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) {
|
for (i = 0; i < len; ++i) {
|
||||||
PyObject* fdobj = PyTuple_GET_ITEM(py_fds_to_keep, i);
|
PyObject* fdobj = PyTuple_GET_ITEM(py_fds_to_keep, i);
|
||||||
long fd = PyLong_AsLong(fdobj);
|
long fd = PyLong_AsLong(fdobj);
|
||||||
if (PyErr_Occurred()) {
|
if (fd == -1 && PyErr_Occurred()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (fd < 0 || fd > INT_MAX) {
|
if (fd < 0 || fd > INT_MAX) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue