[New-bugs-announce] [issue13827] Unexecuted import changes namespace
report at bugs.python.org
Thu Jan 19 17:02:19 CET 2012
New submission from Michael Hipp <michael at redmule.com>:
A local *unexecuted* import appears to be changing the namespace. Attached files are ready to run.
SOMETHING = "overridden"
OVERRIDE = False
SOMETHING = "original"
#global SOMETHING # uncomment and it works
from over import SOMETHING # comment out and it works
print SOMETHING # UnboundLocalError: local variable 'SOMETHING' referenced before assignment
The SOMETHING variable has a value from the module global namespace, but it gets lost due to an import that is never executed.
I would think an unexecuted statement shouldn't have any effect on anything.
The second file will have to be submitted in a follow-on, it appears
title: Unexecuted import changes namespace
versions: Python 2.7
Added file: http://bugs.python.org/file24278/main.py
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce