[issue4617] SyntaxError when free variable name is also an exception target

2013-04-18 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue4617] SyntaxError when free variable name is also an exception target

2010-09-10 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Fixed in r84685, with tests and doc updates. -- resolution: accepted -> fixed stage: unit test needed -> committed/rejected status: open -> closed ___ Python tracker

[issue4617] SyntaxError when free variable name is also an exception target

2010-09-10 Thread Amaury Forgeot d'Arc
Changes by Amaury Forgeot d'Arc : -- assignee: -> amaury.forgeotdarc resolution: -> accepted ___ Python tracker ___ ___ Python-bugs-l

[issue4617] SyntaxError when free variable name is also an exception target

2010-08-08 Thread Stefan Behnel
Changes by Stefan Behnel : -- nosy: -scoder ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue4617] SyntaxError when free variable name is also an exception target

2010-08-08 Thread Guido van Rossum
Guido van Rossum added the comment: Yeah, please fix in 3.2, don't fix in 2.7. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue4617] SyntaxError when free variable name is also an exception target

2010-08-08 Thread Terry J. Reedy
Terry J. Reedy added the comment: I have changed my mind on this issue. Since e = 1 del e def g(): print(e) g() compiles and raises a run-time name error, so should the same code embedded within a function. In either case, the premature deletion is a logic error, not a syntax error. However

[issue4617] SyntaxError when free variable name is also an exception target

2010-08-08 Thread Florent Xicluna
Florent Xicluna added the comment: This bug is waiting for unit tests and a small patch cleanup. See previous message: http://bugs.python.org/issue4617#msg99950 -- keywords: -needs review nosy: +ezio.melotti, scoder versions: +Python 3.2 -Python 3.0 ___

[issue4617] SyntaxError when free variable name is also an exception target

2010-03-13 Thread Florent Xicluna
Changes by Florent Xicluna : -- components: +Interpreter Core nosy: +flox stage: -> test needed type: -> behavior ___ Python tracker ___

[issue4617] SyntaxError when free variable name is also an exception target

2010-03-13 Thread Florent Xicluna
Changes by Florent Xicluna : Removed file: http://bugs.python.org/file16341/unnamed ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue4617] SyntaxError when free variable name is also an exception target

2010-02-23 Thread Jeremy Hylton
Jeremy Hylton added the comment: The patch looks pretty good. I'd factor out the common error-checking code (common between LOAD_DEREF and DELETE_DEREF) into a helper function. It would also be good to add some test cases. Jeremy On Tue, Feb 23, 2010 at 9:38 AM, Guido van Rossum wrote: > >

[issue4617] SyntaxError when free variable name is also an exception target

2010-02-23 Thread Guido van Rossum
Guido van Rossum added the comment: I don't think so. It's very marginal. --Guido (on Android) On Feb 23, 2010 8:52 AM, "Amaury Forgeot d'Arc" wrote: Amaury Forgeot d'Arc added the comment: The above patch adds a new opcode (DELETE_DEREF), does the Moratorium apply here? -- _

[issue4617] SyntaxError when free variable name is also an exception target

2010-02-23 Thread Guido van Rossum
Guido van Rossum added the comment: On Mon, Feb 22, 2010 at 6:51 PM, Jeremy Hylton wrote: > There's no reason we couldn't revise the language spec to explain that > except clauses and comprehensions are block statements, i.e. > statements that introduce a new block. However (even apart from th

[issue4617] SyntaxError when free variable name is also an exception target

2010-02-22 Thread Jeremy Hylton
Jeremy Hylton added the comment: On Mon, Feb 22, 2010 at 6:10 PM, Guido van Rossum wrote: > > Guido van Rossum added the comment: > > All examples so far (*) have to do with our inability to have properly nested > blocks. If we did, I'd make the except clause a block, and I'd issue a syntax

[issue4617] SyntaxError when free variable name is also an exception target

2010-02-22 Thread Guido van Rossum
Guido van Rossum added the comment: All examples so far (*) have to do with our inability to have properly nested blocks. If we did, I'd make the except clause a block, and I'd issue a syntax warning or error if a nested block shadowed a variable referenced outside it. Ditto for generator exp

Re: [issue4617] SyntaxError when free variable name is also an exception target

2010-02-22 Thread Jeremy Hylton
It's an interesting bug. Maybe the compiler shouldn't allow you to use such a variable as a free variable in a nested function? On Thu, Feb 11, 2010 at 9:09 PM, Craig McQueen wrote: > > Craig McQueen added the comment: > > There's also this one which caught me out: > > def outer(): >  x = 0 >  

[issue4617] SyntaxError when free variable name is also an exception target

2010-02-11 Thread Craig McQueen
Craig McQueen added the comment: There's also this one which caught me out: def outer(): x = 0 y = (x for i in range(10)) del x # SyntaxError -- nosy: +cmcqueen1975 ___ Python tracker __

[issue4617] SyntaxError when free variable name is also an exception target

2009-01-05 Thread Guido van Rossum
Guido van Rossum added the comment: I don't think this has much to do with try/except. That it works in 2.6 but not in 3.0 isn't a big deal; the semantics of variables used in except clauses has changed dramatically. It has to do with deletion of a variable that's held in a cell for reference

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-28 Thread Benjamin Peterson
Benjamin Peterson added the comment: I think being able to delete free variables is reasonable and brings more consistency as well as solving corner cases like this. -- nosy: +benjamin.peterson ___ Python tracker _

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-19 Thread Martin v. Löwis
Changes by Martin v. Löwis : -- priority: deferred blocker -> release blocker ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Guido, any thoughts? -- assignee: pje -> gvanrossum nosy: +gvanrossum ___ Python tracker ___ ___

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-12 Thread Phillip J. Eby
Phillip J. Eby added the comment: I could argue either way on this one; it's true that deleting a nested-scope variable is sometimes desirable, but it also seems to me like closing over an except: variable is a Potentially Bad Idea. In neither case, however, do I think it's appropriate to drop

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-12 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Terry, my motivation is that the sample code above runs correctly with python 2.6, but python 3.0 cannot even compile it. The sample looks valid python code, and should run. Yes, the same 'e' is used both as a nested variable and as an exception target,

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Not sure the "del e" idea was a good solution to the garbage collection problem. Amaury's code looks correct to me. Maybe the existing e variable should be overwritten and the left intact (as it used to be) or perhaps it should be made both temporary and in

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: -1 as I understand the proposal. Your code is bugged and should fail as soon as possible. If I understand correctly, you agree that the SyntaxError is correct as the language is currently defined, but you want the definition changed. It is not clear if you onl

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-10 Thread Benjamin Peterson
Changes by Benjamin Peterson <[EMAIL PROTECTED]>: -- nosy: +jhylton ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mail

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-10 Thread Martin v. Löwis
Changes by Martin v. Löwis <[EMAIL PROTECTED]>: -- priority: release blocker -> deferred blocker ___ Python tracker <[EMAIL PROTECTED]> ___

[issue4617] SyntaxError when free variable name is also an exception target

2008-12-10 Thread Amaury Forgeot d'Arc
New submission from Amaury Forgeot d'Arc <[EMAIL PROTECTED]>: This issue comes from issue4613. The following code raises a SyntaxError("can not delete variable 'e' referenced in nested scope"): def f(): e = None def g(): e try: pass except Exception as e: