Title: Assertion failed in ceval.c
Type: crash Stage:
Components: Interpreter Core Versions: Python 3.11
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Mark.Shannon Nosy List: Mark.Shannon, brandtbucher, kumaraditya303
Priority: release blocker Keywords:

Created on 2022-01-14 10:04 by kumaraditya303, last changed 2022-01-17 14:05 by Mark.Shannon.

Messages (3)
msg410550 - (view) Author: Kumar Aditya (kumaraditya303) * Date: 2022-01-14 10:06
The following code causes Assertion failed on Windows 11 

import cProfile
def test():
    import sys
    import dis

with cProfile.Profile() as p:


❯ ./python.bat 
Running Debug|x64 interpreter...
Assertion failed: frame->f_lasti >= 0, file D:\cpython\Python\ceval.c, line 6509
msg410551 - (view) Author: Kumar Aditya (kumaraditya303) * Date: 2022-01-14 10:10
Tested commit is 7c770d3350813a82a639fcb3babae0de2b87aaae
msg410553 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2022-01-14 11:07
I can reproduce this on linux.

The problem is that when closing a generator that has not started, the frame may not be in a valid state (hence the assertion failure).

This should be fixed by implementing as that will ensure that the frame is in a valid state before the generator is created.

I'll make implementing a priority in order to fix this.
Date User Action Args
2022-01-17 14:05:10Mark.Shannonsetpriority: normal -> release blocker
2022-01-14 11:07:57Mark.Shannonsetassignee: Mark.Shannon

messages: + msg410553
nosy: + brandtbucher
2022-01-14 10:14:02kumaraditya303setnosy: + Mark.Shannon
2022-01-14 10:10:27kumaraditya303setmessages: + msg410551
2022-01-14 10:06:30kumaraditya303setmessages: + msg410550
2022-01-14 10:04:47kumaraditya303setversions: + Python 3.11
2022-01-14 10:04:33kumaraditya303create