[New-bugs-announce] [issue4613] Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python shows no traceback

Albert Hopkins report at bugs.python.org
Tue Dec 9 20:36:06 CET 2008


New submission from Albert Hopkins <marduk at python.net>:

Say I have module foo.py:

        def a(x):
           def b():
               x
           del x
        
If I run foo.py under Python 2.4.4 I get:

          File "foo.py", line 4
            del x
        SyntaxError: can not delete variable 'x' referenced in nested
        scope

Under Python 2.6 and Python 3.0 I get:

        SyntaxError: can not delete variable 'x' referenced in nested
        scope


The difference is under Python 2.4 I get a traceback with the lineno and
offending line, but I do not get a traceback in Pythons 2.6 and 3.0.

This also kinda relates to the 2to3 tool.  See:

http://groups.google.com/group/comp.lang.python/browse_frm/thread/a6600c80f8c3c60c/4d804532ea09aae7

----------
components: Interpreter Core
messages: 77443
nosy: marduk
severity: normal
status: open
title: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python shows no traceback
type: behavior
versions: Python 2.6, Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4613>
_______________________________________


More information about the New-bugs-announce mailing list