Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(86185)

Unified Diff: Python/future.c

Issue 11619: On Windows, don't encode filenames in the import machinery
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Python/errors.c ('k') | Python/pythonrun.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Python/future.c Mon Aug 26 14:05:19 2013 +0200
+++ b/Python/future.c Mon Aug 26 16:10:52 2013 +0200
@@ -11,7 +11,7 @@
"from __future__ imports must occur at the beginning of the file"
static int
-future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
+future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
{
int i;
asdl_seq *names;
@@ -43,12 +43,12 @@ future_check_features(PyFutureFeatures *
} else if (strcmp(feature, "braces") == 0) {
PyErr_SetString(PyExc_SyntaxError,
"not a chance");
- PyErr_SyntaxLocationEx(filename, s->lineno, s->col_offset);
+ PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset);
return 0;
} else {
PyErr_Format(PyExc_SyntaxError,
UNDEFINED_FUTURE_FEATURE, feature);
- PyErr_SyntaxLocationEx(filename, s->lineno, s->col_offset);
+ PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset);
return 0;
}
}
@@ -56,7 +56,7 @@ future_check_features(PyFutureFeatures *
}
static int
-future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename)
+future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
{
int i, done = 0, prev_line = 0;
stmt_ty first;
@@ -101,7 +101,7 @@ future_parse(PyFutureFeatures *ff, mod_t
if (done) {
PyErr_SetString(PyExc_SyntaxError,
ERR_LATE_FUTURE);
- PyErr_SyntaxLocationEx(filename, s->lineno, s->col_offset);
+ PyErr_SyntaxLocationObject(filename, s->lineno, s->col_offset);
return 0;
}
if (!future_check_features(ff, s, filename))
@@ -121,7 +121,7 @@ future_parse(PyFutureFeatures *ff, mod_t
PyFutureFeatures *
-PyFuture_FromAST(mod_ty mod, const char *filename)
+PyFuture_FromASTObject(mod_ty mod, PyObject *filename)
{
PyFutureFeatures *ff;
@@ -139,3 +139,18 @@ PyFuture_FromAST(mod_ty mod, const char
}
return ff;
}
+
+
+PyFutureFeatures *
+PyFuture_FromAST(mod_ty mod, const char *filename_str)
+{
+ PyFutureFeatures *ff;
+ PyObject *filename;
+
+ filename = PyUnicode_DecodeFSDefault(filename_str);
+ if (filename == NULL)
+ return NULL;
+ ff = PyFuture_FromASTObject(mod, filename);
+ Py_DECREF(filename);
+ return ff;
+}
« no previous file with comments | « Python/errors.c ('k') | Python/pythonrun.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+