mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Modules/) (#102196)
This commit is contained in:
parent
568fc0dee4
commit
2db23d10bf
18 changed files with 136 additions and 169 deletions
|
@ -5175,10 +5175,9 @@ static void
|
|||
sock_finalize(PySocketSockObject *s)
|
||||
{
|
||||
SOCKET_T fd;
|
||||
PyObject *error_type, *error_value, *error_traceback;
|
||||
|
||||
/* Save the current exception, if any. */
|
||||
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
||||
PyObject *exc = PyErr_GetRaisedException();
|
||||
|
||||
if (s->sock_fd != INVALID_SOCKET) {
|
||||
if (PyErr_ResourceWarning((PyObject *)s, 1, "unclosed %R", s)) {
|
||||
|
@ -5202,7 +5201,7 @@ sock_finalize(PySocketSockObject *s)
|
|||
}
|
||||
|
||||
/* Restore the saved exception. */
|
||||
PyErr_Restore(error_type, error_value, error_traceback);
|
||||
PyErr_SetRaisedException(exc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue