[Python-checkins] r85570 - in python/branches/py3k/Python: ast.c pythonrun.c
victor.stinner
python-checkins at python.org
Sat Oct 16 15:42:53 CEST 2010
Author: victor.stinner
Date: Sat Oct 16 15:42:53 2010
New Revision: 85570
Log:
Fix ast_error_finish() and err_input(): filename can be NULL
Fix my previous commit (r85569).
Modified:
python/branches/py3k/Python/ast.c
python/branches/py3k/Python/pythonrun.c
Modified: python/branches/py3k/Python/ast.c
==============================================================================
--- python/branches/py3k/Python/ast.c (original)
+++ python/branches/py3k/Python/ast.c Sat Oct 16 15:42:53 2010
@@ -131,7 +131,12 @@
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
Modified: python/branches/py3k/Python/pythonrun.c
==============================================================================
--- python/branches/py3k/Python/pythonrun.c (original)
+++ python/branches/py3k/Python/pythonrun.c Sat Oct 16 15:42:53 2010
@@ -2054,7 +2054,12 @@
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);
More information about the Python-checkins
mailing list