+ return msg_buf;
+}
+
+BT_HIDDEN
+GString *bt_py_common_format_current_exception(int log_level)
+{
+ GString *result;
+ PyObject *py_exc_type = NULL;
+ PyObject *py_exc_value = NULL;
+ PyObject *py_exc_tb = NULL;
+
+ BT_ASSERT(PyErr_Occurred());
+ PyErr_Fetch(&py_exc_type, &py_exc_value, &py_exc_tb);
+ BT_ASSERT(py_exc_type);
+
+ /*
+ * Make sure `py_exc_value` is what we expected: an instance of
+ * `py_exc_type`.
+ */
+ PyErr_NormalizeException(&py_exc_type, &py_exc_value, &py_exc_tb);
+
+ result = bt_py_common_format_exception(py_exc_type, py_exc_value,
+ py_exc_tb, log_level, true);
+