This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Segfault from new PEG parser handling yield withing f-strings
Type: crash Stage: resolved
Components: Interpreter Core Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, lys.nikolaou, miss-islington, pablogsal, stestagg
Priority: normal Keywords: 3.9regression, patch

Created on 2020-06-07 23:06 by stestagg, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 20701 merged pablogsal, 2020-06-08 00:09
PR 20702 merged miss-islington, 2020-06-08 00:48
Messages (4)
msg370923 - (view) Author: Steve Stagg (stestagg) Date: 2020-06-07 23:06
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.
msg370942 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-08 00:47
New changeset 972ab0327675e695373fc6272d5ac24e187579ad by Pablo Galindo in branch 'master':
bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701)
https://github.com/python/cpython/commit/972ab0327675e695373fc6272d5ac24e187579ad
msg370943 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-08 00:48
Thanks, Steve for the report!
msg370946 - (view) Author: miss-islington (miss-islington) Date: 2020-06-08 01:08
New changeset 64409117361499058b1bf95e6efec31f7bb3c0d0 by Miss Islington (bot) in branch '3.9':
bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701)
https://github.com/python/cpython/commit/64409117361499058b1bf95e6efec31f7bb3c0d0
History
Date User Action Args
2022-04-11 14:59:32adminsetgithub: 85081
2020-06-08 01:08:56miss-islingtonsetnosy: + miss-islington
messages: + msg370946
2020-06-08 00:48:33pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-06-08 00:48:28pablogsalsetnosy: - miss-islington
messages: + msg370943
2020-06-08 00:48:01miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request19917
2020-06-08 00:47:41pablogsalsetmessages: + msg370942
2020-06-08 00:09:49pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request19916
2020-06-07 23:49:13vstinnersetkeywords: + 3.9regression
versions: + Python 3.9
2020-06-07 23:48:59vstinnersetnosy: + gvanrossum, lys.nikolaou, pablogsal
2020-06-07 23:06:21stestaggcreate