homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hippmr
Recipients hippmr
Date 2012年01月19日.16:02:18
SpamBayes Score 1.971962e-10
Marked as misclassified No
Message-id <1326988939.6.0.324372233485.issue13827@psf.upfronthosting.co.za>
In-reply-to
Content
A local *unexecuted* import appears to be changing the namespace. Attached files are ready to run.
# over.py
SOMETHING = "overridden"
# main.py
OVERRIDE = False
SOMETHING = "original"
def main():
 #global SOMETHING # uncomment and it works
 if OVERRIDE:
 from over import SOMETHING # comment out and it works
 pass
 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
History
Date User Action Args
2012年01月19日 16:02:19hippmrsetrecipients: + hippmr
2012年01月19日 16:02:19hippmrsetmessageid: <1326988939.6.0.324372233485.issue13827@psf.upfronthosting.co.za>
2012年01月19日 16:02:19hippmrlinkissue13827 messages
2012年01月19日 16:02:18hippmrcreate

AltStyle によって変換されたページ (->オリジナル) /