[issue27999] Make "global after use" a SyntaxError

2016-09-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 804b71d43c85 by Guido van Rossum in branch 'default': Issue #27999: Make "global after use" a SyntaxError, and ditto for nonlocal. https://hg.python.org/cpython/rev/804b71d43c85 -- nosy: +python-dev ___

[issue27999] Make "global after use" a SyntaxError

2016-09-09 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks again Ivan! -- resolution: -> fixed status: open -> closed ___ Python tracker ___

[issue27999] Make "global after use" a SyntaxError

2016-09-09 Thread Guido van Rossum
Guido van Rossum added the comment: I'll commit this. -- assignee: docs@python -> gvanrossum ___ Python tracker ___

[issue27999] Make "global after use" a SyntaxError

2016-09-09 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Added few tests to the patch -- Added file: http://bugs.python.org/file44503/patch-v2.diff ___ Python tracker ___

[issue27999] Make "global after use" a SyntaxError

2016-09-09 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: I am attaching the patch. Yury, I also added you here, just in case you have time for this. Btw, while working on this I have found that the second restriction: """ Names listed in a global statement must not be ... in a for loop control target, class

[issue27999] Make "global after use" a SyntaxError

2016-09-07 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: OK, then I think after will be safer. Let us came back to this right after PEP 526. -- ___ Python tracker ___

[issue27999] Make "global after use" a SyntaxError

2016-09-07 Thread Guido van Rossum
Guido van Rossum added the comment: I strongly prefer to have it as a separate patch (either before or after) to avoid the appearance of piggy-backing this in with a much larger change. -- ___ Python tracker

[issue27999] Make "global after use" a SyntaxError

2016-09-07 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Yes, nonlocal will be fixed too. This will be a relatively small patch, but I am a bit afraid there could be merge conflicts (the code affected could overlap with changes for PEP 526). Easiest way would be to simply make this a single patch with PEP 526

[issue27999] Make "global after use" a SyntaxError

2016-09-07 Thread Guido van Rossum
Guido van Rossum added the comment: I like fixing this. I suppose it'll be fixed for nonlocal too? -- ___ Python tracker ___

[issue27999] Make "global after use" a SyntaxError

2016-09-07 Thread Ivan Levkivskyi
New submission from Ivan Levkivskyi: The documentation at https://docs.python.org/3/reference/simple_stmts.html says that: "Names listed in a global statement must not be used in the same code block textually preceding that global statement" But then later: "CPython implementation detail: