python / python/cpython

__file__ for Some Dynamic Extension Modules has a Broken Refcount

未關閉
#118,733 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

3.13 interpreter-core type-bug
主要語言
Python
星號
77.2k
分支
35.9k
PR 合併指標
PR 指標待擷取

描述

Bug report

Bug description:

In gh-118532 I was getting crashes when the _testsinglephase module's cached copy of __dict__ was finalized. I worked around it in that PR by doing an unconditional incref, but that introduced a refleak for other cases. At the time, I wasn't able to determine if gh-118532 was the source of the refcount problem or if it only exposed an existing problem.

While working on gh-118157 I narrowed the problem down to the __file__ value in the cached __dict__ and resolved it by interning the string. However, the underlying problem remains: somewhere along the line there seems to be a missing incref.

That needs to be located and fixed, and then the interning can be dropped.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先閱讀 gh-118532 和 gh-118157,重點關注 _testsinglephase、快取的 dict 及其 file 值。在 CPython main branch 上重現 refcount 失敗,追蹤缺少的 incref 發生在哪裡,並確認 fix 在沒有 workaround 的 refleak 的情況下能夠正常運作,以便移除 interning。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
backend
Issue 類型
缺陷
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。