]> gerrit.simantics Code Review - simantics/python.git/blobdiff - org.simantics.pythonlink.win32.x86_64/src/sclpy.c
Print exception type name if we can't get a traceback.
[simantics/python.git] / org.simantics.pythonlink.win32.x86_64 / src / sclpy.c
index 8de3c87ea29517cd42438f8a04fdca3575d4fc8a..8e41834ee1d2c505bc0a8e4764782e4c08323503 100644 (file)
@@ -886,7 +886,11 @@ Java_org_simantics_pythonlink_PythonContext_executePythonStatementImpl(
                                                                Py_DECREF(message);
                                                        }
                                                        else {
-                                                               throwPythonException(env, "Internal error, no message");
+                                                               PyTypeObject
+                                                                       *ty = (PyTypeObject *)exceptionType;
+                                                               throwPythonException(
+                                                                               env, ty ? ty->tp_name
+                                                                                               : "Internal error, null exception type");
                                                        }
                                                        Py_DECREF(args);
                                                        Py_DECREF(formatExc);
@@ -900,6 +904,9 @@ Java_org_simantics_pythonlink_PythonContext_executePythonStatementImpl(
                                                throwPythonException(env, "Internal error, no traceback module");
                                        }
                                }
+                               Py_XDECREF(exceptionType);
+                               Py_XDECREF(exception);
+                               Py_XDECREF(traceback);
                        }
 
                        PyEval_SaveThread();