-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
__future__
imports don't check the amount of dots while checking from
-import
nodes for the module name, so they are still valid even if dots are put before the module name.
>>> from .__future__ import barry_as_FLUFL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
from .__future__ import barry_as_FLUFL
ImportError: attempted relative import with no known parent package
>>> 1 <> 2
True
Is this intended? Allowing dots before the module name seems improper considering __future__
is supposed to be part of the stdlib.
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Windows
Linked PRs
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error