Title: Missing Py_SetStackPointer call in LIST_APPEND · Issue #151119 · python/cpython · GitHub
Open Graph Title: Missing Py_SetStackPointer call in LIST_APPEND · Issue #151119 · python/cpython
X Title: Missing Py_SetStackPointer call in LIST_APPEND · Issue #151119 · python/cpython
Description: 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_...
Open Graph Description: 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_fra...
X Description: 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-&...
Opengraph URL: https://github.com/python/cpython/issues/151119
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Missing Py_SetStackPointer call in LIST_APPEND","articleBody":"# Bug report\n\n### Bug description:\n\nIn a debug build:\n```python\nimport _testcapi\n_testcapi.set_nomemory(2)\nresult = [f'1{x}' for x in range(1)]\n```\n\n```\nAssertion failed: (tstate-\u003ecurrent_frame == NULL || tstate-\u003ecurrent_frame-\u003estackpointer != NULL), function _Py_Dealloc, file object.c, line 3298.\nfish: Job 1, './python.exe test.py' terminated by signal SIGABRT (Abort)\n```\n\n`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.\n\nUnless there is a performance impact, then I'm assuming this is just a case of calling Py_SetStackPointer at the appropriate point?\n\nPython 3.16.0a0 (heads/main-dirty:29a920e, Jun 9 2026, 00:36:55) [Clang 22.1.6 ]\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-151538\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/stestagg","@type":"Person","name":"stestagg"},"datePublished":"2026-06-09T01:02:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/151119/cpython/issues/151119"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3e4efbd4-0827-c67d-92f5-e81cfc07dd11 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F64:4DD3F:19597B0:21DB853:6A535C73 |
| html-safe-nonce | 757dad6e6d3af863c57463d1e68cb013bafd81d0704432b8952cd69e11c3bc61 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjY0OjRERDNGOjE5NTk3QjA6MjFEQjg1Mzo2QTUzNUM3MyIsInZpc2l0b3JfaWQiOiI1NTAwODg4NjE3MjE4OTU2NDAzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 29a7e9e6c84ca0f88e36a331f0349f91cef2d58b1fac1d9586e03a1fbf0589b9 |
| hovercard-subject-tag | issue:4617833652 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/151119/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c44f15fdd17b3c9a03aa3b322b2f4cf591ec728eb63a7149c8c4b49edb2b13b/python/cpython/issues/151119 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c44f15fdd17b3c9a03aa3b322b2f4cf591ec728eb63a7149c8c4b49edb2b13b/python/cpython/issues/151119 |
| og:image:alt | 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_fra... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | stestagg |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width