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)
23242324 int always_trim = 0 ;
23252325 int in_importlib = 0 ;
23262326 PyObject * * prev_link , * * outer_link = NULL ;
2327+ PyObject * base_tb = NULL ;
23272328
23282329 /* Synopsis: if it's an ImportError, we trim all importlib chunks
23292330 from the traceback. We always trim chunks
@@ -2339,7 +2340,7 @@ remove_importlib_frames(PyThreadState *tstate)
23392340 }
23402341
23412342 assert (PyExceptionInstance_Check (exc ));
2342- PyObject * base_tb = PyException_GetTraceback (exc );
2343+ base_tb = PyException_GetTraceback (exc );
23432344 prev_link = & base_tb ;
23442345 PyObject * tb = base_tb ;
23452346 while (tb != NULL ) {
@@ -2376,6 +2377,7 @@ remove_importlib_frames(PyThreadState *tstate)
23762377 }
23772378 PyException_SetTraceback (exc , base_tb );
23782379done :
2380+ Py_XDECREF (base_tb );
23792381 _PyErr_SetRaisedException (tstate , exc );
23802382}
23812383
You can’t perform that action at this time.
0 commit comments