Skip to content

Commit 71d2958

Browse files
committed
Python/frame.c
1 parent 10738bf commit 71d2958

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Python/frame.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,14 @@ PyFrameObject *
2929
_PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame)
3030
{
3131
assert(frame->frame_obj == NULL);
32-
PyObject *error_type, *error_value, *error_traceback;
33-
PyErr_Fetch(&error_type, &error_value, &error_traceback);
32+
PyObject *exc = PyErr_GetRaisedException();
3433

3534
PyFrameObject *f = _PyFrame_New_NoTrack(frame->f_code);
3635
if (f == NULL) {
37-
Py_XDECREF(error_type);
38-
Py_XDECREF(error_value);
39-
Py_XDECREF(error_traceback);
36+
Py_XDECREF(exc);
4037
return NULL;
4138
}
42-
PyErr_Restore(error_type, error_value, error_traceback);
39+
PyErr_SetRaisedException(exc);
4340
if (frame->frame_obj) {
4441
// GH-97002: How did we get into this horrible situation? Most likely,
4542
// allocating f triggered a GC collection, which ran some code that

0 commit comments

Comments
 (0)