mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-107913: Fix possible losses of OSError error codes (GH-107930)
Functions like PyErr_SetFromErrno() and SetFromWindowsErr() should be called immediately after using the C API which sets errno or the Windows error code.
This commit is contained in:
parent
e407cea193
commit
2b15536fa9
17 changed files with 129 additions and 75 deletions
|
|
@ -1294,8 +1294,8 @@ newPyEpoll_Object(PyTypeObject *type, int sizehint, SOCKET fd)
|
|||
self->epfd = fd;
|
||||
}
|
||||
if (self->epfd < 0) {
|
||||
Py_DECREF(self);
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
Py_DECREF(self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1973,8 +1973,8 @@ newKqueue_Object(PyTypeObject *type, SOCKET fd)
|
|||
self->kqfd = fd;
|
||||
}
|
||||
if (self->kqfd < 0) {
|
||||
Py_DECREF(self);
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
Py_DECREF(self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue