[New-bugs-announce] [issue33547] Relative imports do not replace local variables

Rolf Campbell report at bugs.python.org
Wed May 16 16:46:59 EDT 2018


New submission from Rolf Campbell <thats.unpossible at gmail.com>:

Relative imports do not replace local variables, but also don't fail.  This can cause some very strange outcomes like this simple example:

touch a.py; python3.6 -c 'a=7; b=5; from . import a as b; print(a,b)'

I would expect this to produce "7 <module ...>", but instead, it produces "7 7".

Tested in v3.6.2 and v3.6.5:
Python 3.6.5 (default, Mar 29 2018, 18:20:46) 
[GCC 8.0.1 20180317 (Red Hat 8.0.1-0.19)] on linux

----------
components: Interpreter Core
messages: 316864
nosy: Rolf Campbell
priority: normal
severity: normal
status: open
title: Relative imports do not replace local variables
type: behavior
versions: Python 3.6

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


More information about the New-bugs-announce mailing list