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

2014-06-26 Thread Ned Deily

Changes by Ned Deily :


--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-06-26 Thread Albert Hopkins

Albert Hopkins added the comment:

You can close this one out.  I don't even remember the use case anymore.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-06-26 Thread Mark Lawrence

Mark Lawrence added the comment:

As issue 4617 has been closed as resolved is there anything left to do here?

--
nosy: +BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2010-11-27 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6, Python 3.0

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2008-12-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

I filed issue4617 about the hidden "del e" problem.

Meanwhile, you may try to change some variable names, specially the
exception target (the 'e' in 'except Exception as e')

--
assignee:  -> amaury.forgeotdarc
priority: critical -> normal

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2008-12-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2008-12-09 Thread Albert Hopkins

Albert Hopkins <[EMAIL PROTECTED]> added the comment:

Thanks for looking into this.

Ok... I applied your patch (actually it does not apply against Python
3.0 so I had to change it manually).

Now I'm not sure if this is still an error in the compiler or if it's
truly a problem on my end, but the line given in the error doesn't
contain a del statement at all.

The code basically looks like this:

def method(self):
...
success = False
e = None
try:
success, mydepgraph, dropped_tasks =
resume_depgraph(
self.settings, self.trees,
self._mtimedb, self.myopts,
myparams, self._spinner,
skip_unsatisfied=True)
except depgraph.UnsatisfiedResumeDep as e:
mydepgraph = e.depgraph
dropped_tasks = set()

With the patch, the error occurs at "dropped_tasks = set()" in the
except clause.  The first time that "dropped_tasks" is used in the
entire module is in the try clause.

This is a horrible piece of code (I did not write it).  Do you think the
SyntaxError message could be masking what the real error is?

Again, the python2 version of this module imports fine, but when I run
2to3 on it I get the SyntaxError.  The line of code in question,
however, is unmodified by 2to3.

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2008-12-09 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

+1 compiler_error should be used anyway.

--
keywords:  -needs review
nosy: +benjamin.peterson

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2008-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

Somehow you caught the only SyntaxError that forgets to add filename and 
line information.
Patch attached, at the expense of not displaying the variable name (it 
should be obvious if the line is displayed)

--
keywords: +needs review, patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file12311/syntaxerror.patch

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2008-12-09 Thread Albert Hopkins

New submission from Albert Hopkins <[EMAIL PROTECTED]>:

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 <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com