[New-bugs-announce] [issue37409] relative import_from without parent

Ben Lewis report at bugs.python.org
Wed Jun 26 05:11:26 EDT 2019


New submission from Ben Lewis <benjamin.r.lewis at gmail.com>:

>>> from curses import ascii
>>> from . import ascii

The second line should raise an ImportError but instead succeeds (tested cpython 3.6.7, 3.7.0 and 3.7.3, and from interactive interpreter and scripts). Specifically, builtins.__import__ does not reproduce the behaviour of importlib._bootstrap.__import__; maybe ceval.c:import_from is neglecting to check that there are parent packages when attempting a relative import?

More details here: https://stackoverflow.com/a/56768129/5104777

----------
components: Interpreter Core
messages: 346593
nosy: Ben Lewis2
priority: normal
severity: normal
status: open
title: relative import_from without parent
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37409>
_______________________________________


More information about the New-bugs-announce mailing list