]> gerrit.simantics Code Review - simantics/python.git/commitdiff
Print exception type name if we can't get a traceback. 00/300/2
authorTimo Korvola <Timo.Korvola@vtt.fi>
Mon, 30 Jan 2017 15:58:18 +0000 (17:58 +0200)
committertkorvola <Timo.Korvola@vtt.fi>
Tue, 31 Jan 2017 10:03:41 +0000 (12:03 +0200)
Also decref PyErr_Fetch results.

Change-Id: I3e497d6750b08e24a9631c83a2b6e0e3c1502d79

org.simantics.pythonlink.win32.x86_64/jnipython.dll
org.simantics.pythonlink.win32.x86_64/src/sclpy.c

index 261bac38ed2f79d35f1a626e8e57ccc00aa9a418..dbf7cb48d649a3aaa80feed808f69ac92e32458a 100644 (file)
Binary files a/org.simantics.pythonlink.win32.x86_64/jnipython.dll and b/org.simantics.pythonlink.win32.x86_64/jnipython.dll differ
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();