From 2f2ed1f36c9413ee2cabed8d8300ee080d85f687 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 16 Oct 2010 13:42:53 +0000 Subject: Fix ast_error_finish() and err_input(): filename can be NULL Fix my previous commit (r85569). --- Python/ast.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Python/ast.c') 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 -- cgit v1.2.1