[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-14 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset de2aea0ff02fa9486365ce9d215bef150fae3a0b by Pablo Galindo in branch 'master': bpo-34939: Allow annotated global names in module namespace (GH-9844) https://github.com/python/cpython/commit/de2aea0ff02fa9486365ce9d215bef150fae3a0b

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-13 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +9217 stage: -> patch review ___ Python tracker ___ ___

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-11 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: I think we can just go ahead and allow this. If there is a volunteer, please go ahead, otherwise I will try to find time for this myself. -- ___ Python tracker

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-09 Thread Rohan Padhye
Rohan Padhye added the comment: Another point I'd like to make is that there is no error in either file or interactive if the annotated assignment appears before the `global` declaration like so: ``` x:int = 0 def set_x(): global x x = 1 # Works fine! ``` The syntax error

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This looks similar to say x = 1 global x It is an error in a file, but is not an error in interactive mode. -- nosy: +serhiy.storchaka ___ Python tracker

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-09 Thread Guido van Rossum
Guido van Rossum added the comment: I agree with Ivan. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-09 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Hm, I think this should be allowed. The formulation in the docs is not very clear, but the wording in the PEP clarifies the intention. Indeed, only annotations at the same scope with global declarations should be prohibited. So I think this is a bug.

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-09 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: The error message was added with 6cff8744a0ae58c88728df8bbca4580ffa6c6a86 and issue27999. The docs were also changed as below with the commit : https://docs.python.org/3.8/reference/simple_stmts.html#the-global-statement > Names listed in a

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-08 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +gvanrossum, levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-08 Thread Rohan Padhye
New submission from Rohan Padhye : The following code when run as a script file gives syntax error: ``` def set_x(): global x x = 1 x:int = 0 # SyntaxError: annotated name 'x' can't be global ``` PEP 526 does not seem to forbid this. The error message "annotated name [...] can't