Skip to content

gh-151119: Sync eval stack in LIST_APPEND on allocation failure#151538

Open
bhuvi27 wants to merge 1 commit into
python:mainfrom
bhuvi27:gh-151119-fix-list-append-stack-pointer
Open

gh-151119: Sync eval stack in LIST_APPEND on allocation failure#151538
bhuvi27 wants to merge 1 commit into
python:mainfrom
bhuvi27:gh-151119-fix-list-append-stack-pointer

Conversation

@bhuvi27

@bhuvi27 bhuvi27 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
  • Fix a debug-build abort when LIST_APPEND fails to resize a list under simulated memory pressure (_testcapi.set_nomemory).
  • Drop _PyList_AppendTakeRef from NON_ESCAPING_FUNCTIONS so the cases generator emits stack pointer save/restore around it, same as SET_ADD.
  • Add test_list_append_nomemory_debug regression test.

Fixes #151119

Treat _PyList_AppendTakeRef as an escaping call in the cases generator
so LIST_APPEND and CALL_LIST_APPEND save the stack pointer before list
resize can trigger decref. Add regression test.
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.

Missing Py_SetStackPointer call in LIST_APPEND

1 participant