|
|
|
@ -588,7 +588,15 @@ ast_error(const node *n, const char *errstr) |
|
|
|
PyObject *u = Py_BuildValue("zii", errstr, LINENO(n), n->n_col_offset); |
|
|
|
if (!u) |
|
|
|
return 0; |
|
|
|
/* |
|
|
|
* Prevent the error from being chained. PyErr_SetObject will normalize the |
|
|
|
* exception in order to chain it. ast_error_finish, however, requires the |
|
|
|
* error not to be normalized. |
|
|
|
*/ |
|
|
|
PyObject *save = PyThreadState_GET()->exc_value; |
|
|
|
PyThreadState_GET()->exc_value = NULL; |
|
|
|
PyErr_SetObject(PyExc_SyntaxError, u); |
|
|
|
PyThreadState_GET()->exc_value = save; |
|
|
|
Py_DECREF(u); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|