classification
Title: Parser/pegen.c:68: _PyPegen_check_barry_as_flufl: Assertion `t->type == NOTEQUAL' failed
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, barry, gvanrossum, lys.nikolaou, pablogsal, vstinner
Priority: normal Keywords: patch

Created on 2020-10-30 22:05 by vstinner, last changed 2020-10-31 00:40 by pablogsal. This issue is now closed.

Files
File name Uploaded Description Edit
pgen_bug.py vstinner, 2020-10-30 22:05
Pull Requests
URL Status Linked Edit
PR 23048 merged pablogsal, 2020-10-30 22:15
PR 23051 merged pablogsal, 2020-10-30 23:52
Messages (5)
msg380002 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-30 22:05
When Python is built in debug mode, it fails with an assertion error on the following code:
---
def func1():
    if a != b:
        raise ValueError

def func2():
    try
        return 1
    finally:
        pass
---

Try attached pgen_bug.py:

$ ./python pgen_bug.py 
python: Parser/pegen.c:68: _PyPegen_check_barry_as_flufl: Assertion `t->type == NOTEQUAL' failed.
Abandon (core dumped)
msg380003 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-30 22:06
Barry: what did you do?
msg380004 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-30 22:06
In release mode, there is no assertion error:

$ python3.10 pgen_bug.py 
  File "/home/vstinner/python/master/pgen_bug.py", line 6
    try
       ^
SyntaxError: invalid syntax
msg380014 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-30 23:48
New changeset 06f8c3328dcd81c84d1ee2b3a57b5381dcb38482 by Pablo Galindo in branch 'master':
bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the barry_as_flufl rule (GH-23048)
https://github.com/python/cpython/commit/06f8c3328dcd81c84d1ee2b3a57b5381dcb38482
msg380025 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-10-31 00:40
New changeset ddcd57e3ea75ab0ad370bbaaa6b76338edbca395 by Pablo Galindo in branch '3.9':
[3.9] bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the barry_as_flufl rule (GH-23048) (GH-23051)
https://github.com/python/cpython/commit/ddcd57e3ea75ab0ad370bbaaa6b76338edbca395
History
Date User Action Args
2020-10-31 00:40:51pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-31 00:40:51pablogsalsetmessages: + msg380025
2020-10-30 23:52:56pablogsalsetpull_requests: + pull_request21970
2020-10-30 23:48:48pablogsalsetmessages: + msg380014
2020-10-30 22:15:52pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request21966
2020-10-30 22:06:54vstinnersetmessages: + msg380004
2020-10-30 22:06:25vstinnersetnosy: + BTaskaya
2020-10-30 22:06:15vstinnersetnosy: + barry
messages: + msg380003
2020-10-30 22:05:31vstinnercreate