Missing Py_SetStackPointer call in LIST_APPEND
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
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
Linked PRs
- gh-151538
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue はすでに PR gh-151538 にリンクされているため、独自に始めるのではなく、まずその作業を確認してください。失敗を再現するには、デバッグビルドで、示されている _testcapi.set_nomemory(2) のリスト内包表記の例を実行し、その後 LIST_APPEND、_PyList_AppendTakeRef、_PyList_AppendTakeRefListResize を調べてください。リサイズに失敗したときに object.c のアサーションが発生しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 20/100