New submission from arts stars <stars-of-st...@mediapromo.be>:

Hello,

I have this situation:
----------------
def test():
    
    if True :
        print("Exception"+DiaObjectFactoryHelper)
    else:
        from . import DiaObjectFactoryHelper
        pass
        
test()
---------------
it generates instead of (like the the line 'from . import' is commented) : 
"NameError: name 'DiaObjectFactoryHelper' is not defined"
this:
UnboundLocalError: local variable 'DiaObjectFactoryHelper' referenced before 
assignment


PS: The github authentificatiion did not work, did not manage to grab email 
even if set public

----------
messages: 402663
nosy: stars-of-stras
priority: normal
severity: normal
status: open
title: Conditional import fails and produce UnboundLocalError, if a variable 
machting import name is used before
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45294>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to