diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-02-24 21:43:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-24 21:43:03 +0000 |
commit | 2db23d10bf64bf7c061fd95c6a8079ddc5c9aa4b (patch) | |
tree | aa29d63d7151d976ea301f5fadff1821333690c9 /Modules/socketmodule.c | |
parent | 568fc0dee42a353f327b059a48f97c911de904b3 (diff) | |
download | cpython-git-2db23d10bf64bf7c061fd95c6a8079ddc5c9aa4b.tar.gz |
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Modules/) (#102196)
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 2d300f1943..00608be38f 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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 |