diff options
author | Crowthebird <78076854+thatbirdguythatuknownot@users.noreply.github.com> | 2024-05-02 13:32:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-02 13:32:20 (GMT) |
commit | 7c97dc8c9594c71bd3d1f69758a27de45f57e4c3 (patch) | |
tree | 480d75833e594394bccb168b6b8d86c131d0d65a /Python | |
parent | 67bba9dd0f5b9c2d24c2bc6d239c4502040484af (diff) | |
download | cpython-7c97dc8c9594c71bd3d1f69758a27de45f57e4c3.zip cpython-7c97dc8c9594c71bd3d1f69758a27de45f57e4c3.tar.gz cpython-7c97dc8c9594c71bd3d1f69758a27de45f57e4c3.tar.bz2 |
gh-118216: Don't consider dotted `__future__` imports (#118267)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 2 | ||||
-rw-r--r-- | Python/future.c | 2 |
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__")) { |