diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-02-28 11:50:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 11:50:52 (GMT) |
commit | 4c87537efb5fd28b4e4ee9631076ed5953720156 (patch) | |
tree | 8c8bf4b1c849bc47dc28561d0653c95b33e357db /Python/frame.c | |
parent | 85b1fc1fc5a2e49d521382eaf5e7793175d00371 (diff) | |
download | cpython-4c87537efb5fd28b4e4ee9631076ed5953720156.zip cpython-4c87537efb5fd28b4e4ee9631076ed5953720156.tar.gz cpython-4c87537efb5fd28b4e4ee9631076ed5953720156.tar.bz2 |
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Python/) (#102193)
Diffstat (limited to 'Python/frame.c')
-rw-r--r-- | Python/frame.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/frame.c b/Python/frame.c index b562709..c2c0be3 100644 --- a/Python/frame.c +++ b/Python/frame.c @@ -29,17 +29,14 @@ PyFrameObject * _PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame) { assert(frame->frame_obj == NULL); - PyObject *error_type, *error_value, *error_traceback; - PyErr_Fetch(&error_type, &error_value, &error_traceback); + PyObject *exc = PyErr_GetRaisedException(); PyFrameObject *f = _PyFrame_New_NoTrack(frame->f_code); if (f == NULL) { - Py_XDECREF(error_type); - Py_XDECREF(error_value); - Py_XDECREF(error_traceback); + Py_XDECREF(exc); return NULL; } - PyErr_Restore(error_type, error_value, error_traceback); + PyErr_SetRaisedException(exc); if (frame->frame_obj) { // GH-97002: How did we get into this horrible situation? Most likely, // allocating f triggered a GC collection, which ran some code that |