diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-16 13:42:53 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-16 13:42:53 (GMT) |
commit | 2f2ed1f36c9413ee2cabed8d8300ee080d85f687 (patch) | |
tree | 2b70dbd47a564f7dc1b21708c36bc04ff7f3cdaf /Python/ast.c | |
parent | 4c7c8c30235e42c47500b91549c2b6154b61f883 (diff) | |
download | cpython-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/ast.c')
-rw-r--r-- | Python/ast.c | 7 |
1 files changed, 6 insertions, 1 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 |