Bug report
Bug description:
In a debug build:
import _testcapi
_testcapi.set_nomemory(2)
result = [f'1{x}' for x in range(1)]
Assertion failed: (tstate->current_frame == NULL || tstate->current_frame->stackpointer != NULL), function _Py_Dealloc, file object.c, line 3298.
fish: Job 1, './python.exe test.py' terminated by signal SIGABRT (Abort)
LIST_APPEND op calls _PyList_AppendTakeRef without setting the stack frame, _PyList_AppendTakeRef calls _PyList_AppendTakeRefListResize with a stolen ref to newitem. If the list resize fails, then newitem is decref'd, which can cause a dealloc, which triggers the above assert on a debug build.
Unless there is a performance impact, then I'm assuming this is just a case of calling Py_SetStackPointer at the appropriate point?
Python 3.16.0a0 (heads/main-dirty:29a920e, Jun 9 2026, 00:36:55) [Clang 22.1.6 ]
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Bug report
Bug description:
In a debug build:
LIST_APPENDop calls_PyList_AppendTakeRefwithout setting the stack frame,_PyList_AppendTakeRefcalls_PyList_AppendTakeRefListResizewith a stolen ref tonewitem. If the list resize fails, thennewitemis decref'd, which can cause a dealloc, which triggers the above assert on a debug build.Unless there is a performance impact, then I'm assuming this is just a case of calling Py_SetStackPointer at the appropriate point?
Python 3.16.0a0 (heads/main-dirty:29a920e, Jun 9 2026, 00:36:55) [Clang 22.1.6 ]
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux