]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40334: Produce better error messages for non-parenthesized genexps (GH-20153)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Fri, 22 May 2020 00:56:52 +0000 (03:56 +0300)
committerGitHub <noreply@github.com>
Fri, 22 May 2020 00:56:52 +0000 (01:56 +0100)
commitae145833025b0156ee2a28219e3370f3b27b2a36
treee8898f0408e8de2e7116dd7cef9697b56b04f2e6
parent7864f11cdf12807555d62c7a132c191eb41ecc02
bpo-40334: Produce better error messages for non-parenthesized genexps (GH-20153)

The error message, generated for a non-parenthesized generator expression
in function calls, was still the generic `invalid syntax`, when the generator expression wasn't appearing as the first argument in the call. With this patch, even on input like `f(a, b, c for c in d, e)`, the correct error message gets produced.
Grammar/python.gram
Lib/test/test_syntax.py
Parser/pegen/parse.c
Parser/pegen/pegen.c
Parser/pegen/pegen.h