File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -2324,6 +2324,7 @@ remove_importlib_frames(PyThreadState *tstate)
2324
2324
int always_trim = 0 ;
2325
2325
int in_importlib = 0 ;
2326
2326
PyObject * * prev_link , * * outer_link = NULL ;
2327
+ PyObject * base_tb = NULL ;
2327
2328
2328
2329
/* Synopsis: if it's an ImportError, we trim all importlib chunks
2329
2330
from the traceback. We always trim chunks
@@ -2339,7 +2340,7 @@ remove_importlib_frames(PyThreadState *tstate)
2339
2340
}
2340
2341
2341
2342
assert (PyExceptionInstance_Check (exc ));
2342
- PyObject * base_tb = PyException_GetTraceback (exc );
2343
+ base_tb = PyException_GetTraceback (exc );
2343
2344
prev_link = & base_tb ;
2344
2345
PyObject * tb = base_tb ;
2345
2346
while (tb != NULL ) {
@@ -2376,6 +2377,7 @@ remove_importlib_frames(PyThreadState *tstate)
2376
2377
}
2377
2378
PyException_SetTraceback (exc , base_tb );
2378
2379
done :
2380
+ Py_XDECREF (base_tb );
2379
2381
_PyErr_SetRaisedException (tstate , exc );
2380
2382
}
2381
2383
You can’t perform that action at this time.
0 commit comments