Skip to content

bpo-40334: Correctly identify invalid target in assignment errors #20076

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

Merged
merged 9 commits into from
May 15, 2020
Prev Previous commit
Add a comment explaining why we only visit Tuples and Lists
  • Loading branch information
pablogsal committed May 15, 2020
commit 6a5c4edb3c34d9debf7d93a368443347c8d3ec7c
6 changes: 6 additions & 0 deletions Parser/pegen/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,12 @@ _PyPegen_get_invalid_target(expr_ty e)
}\
} while (0)

// We only need to visit List and Tuple nodes recursively as those
// are the only ones that can contain valid names in targets when
// they are parsed as expressions. Any other kind of expression
// that is a container (like Sets or Dicts) is directly invalid and
// we don't need to visit it recursively.

switch (e->kind) {
case List_kind: {
VISIT_CONTAINER(e, List);
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