diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-11-21 22:58:57 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-11-21 22:58:57 +0000 |
commit | c0fd43262aaba3e37a56c6fc090fb29a86b6b644 (patch) | |
tree | 15bdb637fa6f67a60ac250dc6477b597d093e84d /Python/ast.c | |
parent | 73095567cbadab2cc5193c40994ddde086d170be (diff) | |
download | cpython-c0fd43262aaba3e37a56c6fc090fb29a86b6b644.tar.gz |
Merged revisions 67320 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67320 | benjamin.peterson | 2008-11-21 16:27:24 -0600 (Fri, 21 Nov 2008) | 4 lines
don't segfault when \N escapes are used and unicodedata fails to load
Fixes #4367
........
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c index 1cf100e449..df948501b3 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1321,13 +1321,14 @@ ast_for_atom(struct compiling *c, const node *n) if (PyErr_ExceptionMatches(PyExc_UnicodeError)) { PyObject *type, *value, *tback, *errstr; PyErr_Fetch(&type, &value, &tback); - errstr = ((PyUnicodeErrorObject *)value)->reason; + errstr = PyObject_Str(value); if (errstr) { char *s = ""; char buf[128]; s = _PyUnicode_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); + Py_DECREF(errstr); } else { ast_error(n, "(unicode error) unknown error"); } |