gh-140936: Fix JIT assertion crash at finalization if some generator is alive (GH-140969)

This commit is contained in:
Mikhail Efimov 2025-11-12 22:04:02 +03:00 committed by GitHub
parent 1f381a579c
commit 35ed3e4ced
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View file

@ -2660,6 +2660,25 @@ def f():
f()
def test_interpreter_finalization_with_generator_alive(self):
script_helper.assert_python_ok("-c", textwrap.dedent("""
import sys
t = tuple(range(%d))
def simple_for():
for x in t:
x
def gen():
try:
yield
except:
simple_for()
sys.settrace(lambda *args: None)
simple_for()
g = gen()
next(g)
""" % _testinternalcapi.SPECIALIZATION_THRESHOLD))
def global_identity(x):