diff options
| author | Benjamin Peterson <benjamin@python.org> | 2012-09-02 14:24:44 -0400 |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2012-09-02 14:24:44 -0400 |
| commit | 3def60f886124d4867ac95ec82acfe99b5b2444d (patch) | |
| tree | 02d4f6b1537068346e61566cf02aacc688996269 /Python | |
| parent | d962b5b616aa8908a44b035a6957781c72022aee (diff) | |
| parent | e0772a2071aa586cac9007e810473379299b6cbd (diff) | |
| download | cpython-3def60f886124d4867ac95ec82acfe99b5b2444d.tar.gz | |
merge 3.2 (#15846)
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/ast.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index fc6c565b21..5366dda406 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -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; } |
