summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/future.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Python/future.c')
-rw-r--r--contrib/tools/python3/Python/future.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/tools/python3/Python/future.c b/contrib/tools/python3/Python/future.c
index 998a7f740ea..e411e659dfc 100644
--- a/contrib/tools/python3/Python/future.c
+++ b/contrib/tools/python3/Python/future.c
@@ -1,10 +1,12 @@
#include "Python.h"
#include "pycore_ast.h" // _PyAST_GetDocString()
+#include "pycore_symtable.h" // _PyFutureFeatures
+#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
#define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined"
static int
-future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
+future_check_features(_PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
{
int i;
@@ -60,7 +62,7 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, PyObject *filename)
}
static int
-future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
+future_parse(_PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
{
if (!(mod->kind == Module_kind || mod->kind == Interactive_kind)) {
return 1;
@@ -83,7 +85,7 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
* are another future statement and a doc string.
*/
- if (s->kind == ImportFrom_kind) {
+ if (s->kind == ImportFrom_kind && s->v.ImportFrom.level == 0) {
identifier modname = s->v.ImportFrom.module;
if (modname &&
_PyUnicode_EqualToASCIIString(modname, "__future__")) {
@@ -105,10 +107,10 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
int
-_PyFuture_FromAST(mod_ty mod, PyObject *filename, PyFutureFeatures *ff)
+_PyFuture_FromAST(mod_ty mod, PyObject *filename, _PyFutureFeatures *ff)
{
ff->ff_features = 0;
- ff->ff_location = (_PyCompilerSrcLocation){-1, -1, -1, -1};
+ ff->ff_location = (_Py_SourceLocation){-1, -1, -1, -1};
if (!future_parse(ff, mod, filename)) {
return 0;