summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index da6c15c..1318c09 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1592,6 +1592,13 @@ remove_importlib_frames(PyThreadState *tstate)
Py_DECREF(code);
tb = next;
}
+ assert(PyExceptionInstance_Check(value));
+ assert((PyObject *)Py_TYPE(value) == exception);
+ if (base_tb == NULL) {
+ base_tb = Py_None;
+ Py_INCREF(Py_None);
+ }
+ PyException_SetTraceback(value, base_tb);
done:
_PyErr_Restore(tstate, exception, value, base_tb);
}