Skip to content

Comments

gh-145064: Fix JIT assertion failure during CALL_ALLOC_AND_ENTER_INIT side exit#145100

Open
cocolato wants to merge 2 commits intopython:mainfrom
cocolato:gh-145064
Open

gh-145064: Fix JIT assertion failure during CALL_ALLOC_AND_ENTER_INIT side exit#145100
cocolato wants to merge 2 commits intopython:mainfrom
cocolato:gh-145064

Conversation

@cocolato
Copy link
Contributor

@cocolato cocolato commented Feb 22, 2026

When CALL_ALLOC_AND_ENTER_INIT creates an instance of a heap type (with __slots__ and tp_new == object.__new__), it pushes a shim frame via _PyFrame_PushTrampolineUnchecked. This shim frame has f_funcobj = Py_None:

frame->f_funcobj = PyStackRef_None;

If a JIT trace runs out of buffer space exactly at this shim frame's EXIT_INIT_CHECK instruction, the _EXIT_TRACE terminator hands off to a _COLD_EXIT executor, which calls _PyJit_TryInitializeTracing() with the shim frame. The existing guard only checked func == NULL, but Py_None is not NULL, so control falls through which casue assertion crash.

@cocolato cocolato changed the title gh-145064: Fix JIT crash when _COLD_EXIT tries to trace from _Py_InitCleanup shim frame gh-145064: Fix JIT assertion failure during CALL_ALLOC_AND_ENTER_INIT side exit Feb 22, 2026
@cocolato
Copy link
Contributor Author

cc @Fidget-Spinner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant