Fix T65402: Syntax error causes CPython assert

This commit is contained in:
matc
2019-07-23 20:29:11 +10:00
committed by Campbell Barton
parent 34ad6da4a0
commit 2d98ac33be

View File

@@ -143,7 +143,6 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
/* no traceback available when SyntaxError. /* no traceback available when SyntaxError.
* python has no api's to this. reference parse_syntax_error() from pythonrun.c */ * python has no api's to this. reference parse_syntax_error() from pythonrun.c */
PyErr_NormalizeException(&exception, &value, (PyObject **)&tb); PyErr_NormalizeException(&exception, &value, (PyObject **)&tb);
PyErr_Restore(exception, value, (PyObject *)tb); /* takes away reference! */
if (value) { /* should always be true */ if (value) { /* should always be true */
PyObject *message; PyObject *message;
@@ -165,6 +164,7 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
*lineno = -1; *lineno = -1;
} }
} }
PyErr_Restore(exception, value, (PyObject *)tb); /* takes away reference! */
} }
else { else {
PyErr_NormalizeException(&exception, &value, (PyObject **)&tb); PyErr_NormalizeException(&exception, &value, (PyObject **)&tb);