summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/Python-ast.c4
-rw-r--r--Python/compile.c2
-rw-r--r--Python/future.c2
-rw-r--r--Python/pythonrun.c6
4 files changed, 10 insertions, 4 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 07de6cb6ad..c4861c3ae1 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -371,7 +371,7 @@ static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int
}
PyTuple_SET_ITEM(fnames, i, field);
}
- result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}",
+ result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}",
type, base, "_fields", fnames, "__module__", "_ast");
Py_DECREF(fnames);
return (PyTypeObject*)result;
@@ -2956,7 +2956,7 @@ init_ast(void)
if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return;
if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
return;
- if (PyModule_AddStringConstant(m, "__version__", "42635") < 0)
+ if (PyModule_AddStringConstant(m, "__version__", "42649") < 0)
return;
if(PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return;
if(PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)
diff --git a/Python/compile.c b/Python/compile.c
index 78ae6a7f7f..13e0f6d34d 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -4286,6 +4286,8 @@ compute_code_flags(struct compiler *c)
flags |= CO_GENERATOR;
if (c->c_flags->cf_flags & CO_FUTURE_DIVISION)
flags |= CO_FUTURE_DIVISION;
+ if (c->c_flags->cf_flags & CO_FUTURE_WITH_STATEMENT)
+ flags |= CO_FUTURE_WITH_STATEMENT;
n = PyDict_Size(c->u->u_freevars);
if (n < 0)
return -1;
diff --git a/Python/future.c b/Python/future.c
index 0a87b10066..4a48ba53e4 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -31,6 +31,8 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
ff->ff_features |= CO_FUTURE_DIVISION;
} else if (strcmp(feature, FUTURE_ABSIMPORT) == 0) {
ff->ff_features |= CO_FUTURE_ABSIMPORT;
+ } else if (strcmp(feature, FUTURE_WITH_STATEMENT) == 0) {
+ ff->ff_features |= CO_FUTURE_WITH_STATEMENT;
} else if (strcmp(feature, "braces") == 0) {
PyErr_SetString(PyExc_SyntaxError,
"not a chance");
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 2a6afe24a4..d5c86f2a1f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -690,8 +690,10 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag
/* compute parser flags based on compiler flags */
#define PARSER_FLAGS(flags) \
- (((flags) && (flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \
- PyPARSE_DONT_IMPLY_DEDENT : 0)
+ ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \
+ PyPARSE_DONT_IMPLY_DEDENT : 0) \
+ | ((flags)->cf_flags & CO_FUTURE_WITH_STATEMENT ? \
+ PyPARSE_WITH_IS_KEYWORD : 0)) : 0)
int
PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)