[New-bugs-announce] [issue41848] PEG parser doesn't allow lambda in for_if_clause

Sergei Lebedev report at bugs.python.org
Wed Sep 23 19:33:02 EDT 2020


New submission from Sergei Lebedev <slebedev at google.com>:

Reproducer:

[x for x in [] if lambda: x]

This parses fine in 3.8, but doesn't parse in 3.9 because the grammar expects a disjunction after if in for_if_clause [*]. While this change has zero practical significance, I think it might be useful to maintain a list of such changes for tooling authors (who might need to support multiple Python versions).

[*]: https://github.com/python/cpython/blob/68526fe258da8c01196fd7cf48e8e5f1280bf8fd/Grammar/python.gram#L523

----------
components: Interpreter Core
messages: 377435
nosy: lys.nikolaou, slebedev
priority: normal
severity: normal
status: open
title: PEG parser doesn't allow lambda in for_if_clause
type: behavior
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41848>
_______________________________________


More information about the New-bugs-announce mailing list