You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
__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.
I merged the fix into main (3.13), so I'm closing this.
Arguably this is a bug that could also be fixed in 3.12, but I'd prefer to leave 3.12 unchanged, as the bug is rather harmless in practice and I feel core language behavior shouldn't change in a bugfix release.
Activity
terryjreedy commentedon Apr 24, 2024
What is weird is both raising an error and doing the pseudoimport anyway.
gh-118216: Don't consider dotted `__future__` imports (#118267)
JelleZijlstra commentedon May 2, 2024
Thanks @thatbirdguythatuknownot!
I merged the fix into main (3.13), so I'm closing this.
Arguably this is a bug that could also be fixed in 3.12, but I'd prefer to leave 3.12 unchanged, as the bug is rather harmless in practice and I feel core language behavior shouldn't change in a bugfix release.
pythongh-118216: Don't consider dotted `__future__` imports (python#1…