summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c2
-rw-r--r--Python/future.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 4e94f92..feedd98 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3849,7 +3849,7 @@ compiler_from_import(struct compiler *c, stmt_ty s)
}
if (location_is_after(LOC(s), c->c_future.ff_location) &&
- s->v.ImportFrom.module &&
+ s->v.ImportFrom.module && s->v.ImportFrom.level == 0 &&
_PyUnicode_EqualToASCIIString(s->v.ImportFrom.module, "__future__"))
{
Py_DECREF(names);
diff --git a/Python/future.c b/Python/future.c
index 399345b..8d94d51 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -77,7 +77,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__")) {