[New-bugs-announce] [issue40904] Segfault from new PEG parser handling yield withing f-strings

Steve Stagg report at bugs.python.org
Sun Jun 7 19:06:21 EDT 2020


New submission from Steve Stagg <stestagg at gmail.com>:

The following command causes python to segfault:

$ echo "f'{yield}'" | python/bin/python3

Bisect tracked this down to:

c5fc15685202cda73f7c3f5c6f299b0945f58508 (bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503))

The illegal access is coming out of `fstring_shift_children_locations`
as n->v.Yield.value is None.

Correspondingly, the following produces the expected output:

$ echo "f'{yield 1}'" | python/bin/python3

Suggesting there's a missing check for no yield value in this code.

----------
components: Interpreter Core
messages: 370923
nosy: stestagg
priority: normal
severity: normal
status: open
title: Segfault from new PEG parser handling yield withing f-strings
type: crash
versions: Python 3.10

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


More information about the New-bugs-announce mailing list