Skip to content

bpo-37757: Disallow PEP 572 cases that expose implementation details #15131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prev Previous commit
Next Next commit
Add comment for iteration variable marking
  • Loading branch information
ncoghlan authored Aug 14, 2019
commit 40307d59f51b2623befe68b1a7d051537364fa75
5 changes: 5 additions & 0 deletions Python/symtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,11 @@ symtable_add_def_helper(struct symtable *st, PyObject *name, int flag, struct _s
val = flag;
}
if (ste->ste_comp_iter_target) {
/* This name is an iteration variable in a comprehension,
* so check for a binding conflict with any named expressions.
* Otherwise, mark it as an iteration variable so subsequent
* named expressions can check for conflicts.
*/
if (val & (DEF_GLOBAL | DEF_NONLOCAL)) {
PyErr_Format(PyExc_SyntaxError,
NAMED_EXPR_COMP_INNER_LOOP_CONFLICT, name);
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy