Possibly spurious SyntaxError: annotated name can't be global #79120
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee = None closed_at = <Date 2018-10-14.17:07:08.454> created_at = <Date 2018-10-09.01:58:38.509> labels = ['interpreter-core', 'type-bug', '3.7'] title = "Possibly spurious SyntaxError: annotated name can't be global" updated_at = <Date 2018-10-14.17:07:08.453> user = 'https://github.com/rohanpadhye'
activity = <Date 2018-10-14.17:07:08.453> actor = 'pablogsal' assignee = 'none' closed = True closed_date = <Date 2018-10-14.17:07:08.454> closer = 'pablogsal' components = ['Interpreter Core'] creation = <Date 2018-10-09.01:58:38.509> creator = 'rohanpadhye' dependencies =  files =  hgrepos =  issue_num = 34939 keywords = ['patch'] message_count = 8.0 messages = ['327378', '327384', '327386', '327420', '327421', '327424', '327554', '327716'] nosy_count = 6.0 nosy_names = ['gvanrossum', 'serhiy.storchaka', 'levkivskyi', 'pablogsal', 'xtreak', 'rohanpadhye'] pr_nums = ['9844'] priority = 'normal' resolution = None stage = 'resolved' status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue34939' versions = ['Python 3.7']
The text was updated successfully, but these errors were encountered:
The following code when run as a script file gives syntax error:
PEP-526 does not seem to forbid this. The error message "annotated name [...] can't be global" is usually seen when using the
Is this a bug in CPython? Or should the PEP-526 document say something about forward references?
Interestingly, if the above program is run in interactive mode, there is no syntax error.
In interactive mode:
Further, forward references work fine with
I don't see why a forward reference in
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
The syntax error specifically occurs when the annotated assignment occurs after a
Neither the docs nor the PEP say anything about such an ordering constraint.
* Split compatibility map into few YAML configurations * Refactoring in thirdparties enrichment * Implementation of thirdparties management automation * Haproxy and Keepalived no longer depend in Kubernetes version * Add synchronization of packages * Add synchronization of kubernetes images. * Rename plugins * Add synchronization of plugins * Move from globals.yaml and auto synchronize supported kubernetes_versions * Make manifest enrichment independent on cluster and run test enrichment * Workaround python/cpython#79120 * Implement simple test of thirdparties sync * Stage all changed and added files * Print links to software requirements * Take package versions from previous Kubernetes version * Changes to support PR #416 * Add more integration tests * Refactoring for unit tests * Implement unit tests * Remove unnecessary option * Auto-update license header * Fix upgrade of pause and reconfigure containerd --------- Co-authored-by: ilia1243 <email@example.com>