diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2021-11-05 13:54:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 13:54:55 (GMT) |
commit | e2d65630f36712dbdbf7711520c985c526a5cc25 (patch) | |
tree | 25c852d1df29dd479743b2dfef60ae7c1d09f2bd /Grammar | |
parent | 32f55d1a5de66f9a86964fc0655d7a006a9d90b9 (diff) | |
download | cpython-e2d65630f36712dbdbf7711520c985c526a5cc25.zip cpython-e2d65630f36712dbdbf7711520c985c526a5cc25.tar.gz cpython-e2d65630f36712dbdbf7711520c985c526a5cc25.tar.bz2 |
bpo-45716: Improve the error message when using True/False/None as keywords in a call (GH-29413)
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/python.gram | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram index a8c693d..ffe035f 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -1062,6 +1062,8 @@ invalid_arguments: RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, asdl_seq_GET(b, b->size-1)->target, "Generator expression must be parenthesized") } | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) } invalid_kwarg: + | a[Token*]=('True'|'False'|'None') b='=' { + RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot assign to %s", PyBytes_AS_STRING(a->bytes)) } | a=NAME b='=' expression for_if_clauses { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?")} | !(NAME '=') a=expression b='=' { |