Skip to content

JIT: co != NULL assertion failure in *_Py_uop_frame_new #145064

@devdanzin

Description

@devdanzin

Crash report

What happened?

Running mypy with the --strict flag will sometimes abort a JIT build:

mypy --no-incremental --strict -c "pass"
python: Python/optimizer_symbols.c:1318: _Py_UOpsAbstractFrame *_Py_uop_frame_new(JitOptContext *, PyCodeObject *, int, JitOptRef *, int): Assertion `co != NULL' failed.
Aborted

Backtrace:

python: Python/optimizer_symbols.c:1318: _Py_UOpsAbstractFrame *_Py_uop_frame_new(JitOptContext *, PyCodeObject *, int, JitOptRef *, int): Assertion `co != NULL' failed.

Program received signal SIGABRT, Aborted.

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:100
#3  0x00007ffff7c45e2e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7c28888 in __GI_abort () at ./stdlib/abort.c:77
#5  0x00007ffff7c287f0 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at ./assert/assert.c:118
#6  0x00007ffff7c3c19f in __assert_fail (assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at ./assert/assert.c:127
#7  0x000055555647cc75 in _Py_uop_frame_new (ctx=ctx@entry=0x7bfff47c28a0, co=<optimized out>, curr_stackentries=curr_stackentries@entry=2, args=args@entry=0x0, arg_len=arg_len@entry=0)
    at Python/optimizer_symbols.c:1318
#8  0x000055555645fbbc in optimize_uops (tstate=<optimized out>, trace=<optimized out>, trace_len=<optimized out>, curr_stacklen=<optimized out>, output=<optimized out>,
    dependencies=<optimized out>) at Python/optimizer_analysis.c:477
#9  0x000055555645f177 in _Py_uop_analyze_and_optimize (tstate=0x227c2a, buffer=buffer@entry=0x7bfff47e6518, length=6, curr_stacklen=2, output=0x16, output@entry=0x7bfff47ec2d8,
    dependencies=0x7bfff47c2870) at Python/optimizer_analysis.c:720
#10 0x000055555644feac in uop_optimize (frame=0x7e8ff6de6278, tstate=0x555556f4a4a0 <_PyRuntime+360512>, progress_needed=false, exec_ptr=<optimized out>) at Python/optimizer.c:1515
#11 _PyOptimizer_Optimize (frame=frame@entry=0x7e8ff6de6278, tstate=tstate@entry=0x555556f4a4a0 <_PyRuntime+360512>) at Python/optimizer.c:169
#12 0x0000555555ef57eb in stop_tracing_and_jit (tstate=0x555556f4a4a0 <_PyRuntime+360512>, frame=frame@entry=0x7e8ff6de6278) at Python/ceval.c:1145
#13 0x0000555555eb07a7 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at Python/generated_cases.c.h:11959
#14 0x0000555555e8d1b8 in _PyEval_EvalFrame (tstate=0x555556f4a4a0 <_PyRuntime+360512>, frame=0x7e8ff6de53c8, throwflag=0) at ./Include/internal/pycore_ceval.h:118
#15 _PyEval_Vector (tstate=<optimized out>, func=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, kwnames=0x0) at Python/ceval.c:2132
#16 0x0000555555e8cbd5 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=0x7c7ff6e87340) at Python/ceval.c:680
#17 0x0000555555e7fe47 in builtin_exec_impl (module=0x7ccff6de6380, source=0x7d2ff6e36a50, globals=0x7c7ff6e87340, locals=0x7c7ff6e87340, closure=0x0) at Python/bltinmodule.c:1249
#18 builtin_exec (module=<optimized out>, args=0x7bfff5bfe428, nargs=<optimized out>, kwnames=0x0) at Python/clinic/bltinmodule.c.h:674
#19 0x0000555555c15b5c in cfunction_vectorcall_FASTCALL_KEYWORDS (func=func@entry=0x7c7ff6e35d40, args=args@entry=0x7bfff5bfe428, nargsf=nargsf@entry=9223372036854775810,
    kwnames=kwnames@entry=0x0) at Objects/methodobject.c:465
#20 0x0000555555af4b40 in _PyObject_VectorcallTstate (tstate=0x555556f4a4a0 <_PyRuntime+360512>, callable=0x7c7ff6e35d40, args=0x7bfff5bfe428, nargsf=9223372036854775810, kwnames=0x0)
    at ./Include/internal/pycore_call.h:136
#21 0x0000555555e8e31d in _Py_VectorCallInstrumentation_StackRefSteal (callable=..., arguments=<optimized out>, total_args=2, kwnames=..., call_instrumentation=<optimized out>,
    frame=<optimized out>, this_instr=<optimized out>, tstate=<optimized out>) at Python/ceval.c:769
#22 0x0000555555eca2fc in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=<optimized out>, throwflag=<optimized out>) at Python/generated_cases.c.h:1817
#23 0x0000555555e8d1b8 in _PyEval_EvalFrame (tstate=0x555556f4a4a0 <_PyRuntime+360512>, frame=0x7e8ff6de5220, throwflag=0) at ./Include/internal/pycore_ceval.h:118
#24 _PyEval_Vector (tstate=<optimized out>, func=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, kwnames=0x0) at Python/ceval.c:2132
#25 0x0000555555af724a in _PyVectorcall_Call (tstate=<optimized out>, func=<optimized out>, callable=<optimized out>, tuple=0x7c7ff6f45d40, kwargs=<optimized out>) at Objects/call.c:273
#26 0x00005555565608fd in pymain_run_module (modname=0x7c3ff6de1f20 L"mypy", set_argv0=<optimized out>) at Modules/main.c:353
#27 0x000055555655f430 in pymain_run_python (exitcode=0x7bfff5c3ef00) at Modules/main.c:685
#28 Py_RunMain () at Modules/main.c:772

Truncated output from running with PYTHON_LLTRACE=4 PYTHON_OPT_DEBUG=4, the full file is over 150MB:

mypy_abort_lltrace_opt_debug_truncated.txt

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.15.0a6+ (heads/main-dirty:645f5c4a737, Feb 14 2026, 17:12:48) [Clang 21.1.2 (2ubuntu6)]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-JITtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions