gh-118216: Don't consider dotted __future__ imports (#118267)

This commit is contained in:
Crowthebird 2024-05-02 21:32:20 +08:00 committed by GitHub
parent 67bba9dd0f
commit 7c97dc8c95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 2 deletions

View file

@ -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__")) {