[issue4613] Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python shows no traceback
Amaury Forgeot d'Arc
report at bugs.python.org
Wed Dec 10 10:43:57 CET 2008
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
I think I understand. This simple code does not compile with python 3.0:
def f():
e = None
def g():
e
try:
pass
except Exception as e:
pass # SyntaxError here???
The reason is that since 3.0, a "del e" statement is generated by the
compiler (see http://www.python.org/dev/peps/pep-3110/#semantic-changes)
and this conflicts with the first block of the function.
This issue is much more complicated than it seemed...
A solution could be to generate "e=None" instead of "del e".
----------
priority: -> critical
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4613>
_______________________________________
More information about the Python-bugs-list
mailing list