diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-16 13:42:53 +0000 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-16 13:42:53 +0000 |
commit | a92ba0800250ece57c8b4cfa5f8d8fc1558fd024 (patch) | |
tree | 1a6ffed729b08f19690e38cbbb81b1881e123543 /Python/ast.c | |
parent | 24c7fa3b4d2daf8a3b9d1b3c143e6a55b5b2b4d5 (diff) | |
download | cpython-a92ba0800250ece57c8b4cfa5f8d8fc1558fd024.tar.gz |
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 b9beef88ef..d1aa61640a 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 |