summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-11-21 22:52:21 +0000
committerBenjamin Peterson <benjamin@python.org>2008-11-21 22:52:21 +0000
commit71ce9e7ba4f5e06a48a0c455f6a5ae21feacc764 (patch)
tree613a85c00379be3c9eeb2fb3e0653414306dae13 /Python
parent42491ce09c11dd4b7a8f100c92cb614d3fe6c371 (diff)
downloadcpython-git-71ce9e7ba4f5e06a48a0c455f6a5ae21feacc764.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')
-rw-r--r--Python/ast.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 8414c74480..9673cec2db 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -1287,13 +1287,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 = PyString_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");
}