summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-16 13:42:53 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-16 13:42:53 (GMT)
commit2f2ed1f36c9413ee2cabed8d8300ee080d85f687 (patch)
tree2b70dbd47a564f7dc1b21708c36bc04ff7f3cdaf /Python
parent4c7c8c30235e42c47500b91549c2b6154b61f883 (diff)
downloadcpython-2f2ed1f36c9413ee2cabed8d8300ee080d85f687.zip
cpython-2f2ed1f36c9413ee2cabed8d8300ee080d85f687.tar.gz
cpython-2f2ed1f36c9413ee2cabed8d8300ee080d85f687.tar.bz2
Fix ast_error_finish() and err_input(): filename can be NULL
Fix my previous commit (r85569).
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c7
-rw-r--r--Python/pythonrun.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c
index b9beef8..d1aa616 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -131,7 +131,12 @@ ast_error_finish(const char *filename)
Py_INCREF(Py_None);
loc = Py_None;
}
- filename_obj = PyUnicode_DecodeFSDefault(filename);
+ if (filename != NULL)
+ filename_obj = PyUnicode_DecodeFSDefault(filename);
+ else {
+ Py_INCREF(Py_None);
+ filename_obj = Py_None;
+ }
if (filename_obj != NULL)
tmp = Py_BuildValue("(NlOO)", filename_obj, lineno, offset, loc);
else
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 8c535fd..f72c9d7 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -2054,7 +2054,12 @@ err_input(perrdetail *err)
errtext = PyUnicode_DecodeUTF8(err->text, strlen(err->text),
"replace");
}
- filename = PyUnicode_DecodeFSDefault(err->filename);
+ if (err->filename != NULL)
+ filename = PyUnicode_DecodeFSDefault(err->filename);
+ else {
+ Py_INCREF(Py_None);
+ filename = Py_None;
+ }
if (filename != NULL)
v = Py_BuildValue("(NiiN)", filename,
err->lineno, err->offset, errtext);