[Python-checkins] r82717 - python/branches/import_unicode/Parser/tokenizer.c
victor.stinner
python-checkins at python.org
Fri Jul 9 01:33:30 CEST 2010
Author: victor.stinner
Date: Fri Jul 9 01:33:29 2010
New Revision: 82717
Log:
tokenizer uses unicode filename
Modified:
python/branches/import_unicode/Parser/tokenizer.c
Modified: python/branches/import_unicode/Parser/tokenizer.c
==============================================================================
--- python/branches/import_unicode/Parser/tokenizer.c (original)
+++ python/branches/import_unicode/Parser/tokenizer.c Fri Jul 9 01:33:29 2010
@@ -467,10 +467,14 @@
if (io == NULL)
goto cleanup;
- if (tok->filename)
- stream = PyObject_CallMethod(io, "open", "ssis",
- tok->filename, "r", -1, enc);
- else
+ if (tok->filename) {
+ PyObject *filename = PyUnicode_DecodeFSDefault(tok->filename);
+ if (filename == NULL)
+ goto cleanup;
+ stream = PyObject_CallMethod(io, "open", "Osis",
+ filename, "r", -1, enc);
+ Py_DECREF(filename);
+ } else
stream = PyObject_CallMethod(io, "open", "isisOOO",
fileno(tok->fp), "r", -1, enc, Py_None, Py_None, Py_False);
if (stream == NULL)
More information about the Python-checkins
mailing list