[BUG]: PyObject_Type resource leak
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
調査の方向性
include/pybind11/typing.h の 101 行目付近から始め、PYBIND11_OBJECT_DEFAULT(..., PyObject_Type) の宣言を typing::Union、Optional、Final、ClassVar、Literal、TypeVar について調べ、それらの check_ 実装を新しい typing::Object と比較してください。issue はすでにリークを特定しています。PyObject_Type は新しい強い参照を返しますが、check_ はそれを破棄します。まず周囲のマクロ定義を読み、次にそれらの check_ 経路が所有されていない参照を残さなくなったことを、h.ptr() != nullptr のアプローチに合わせて検証してください。完了とは、引数のロードが型参照をリークしなくなったことを意味します。
索引モデルが issue の本文から書いたものです。
説明
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
a3954715fe849519754abded4d572bf7edab67e3
Problem description
PyObject_Type returns a new strong reference to the object's type object which is never decrefed by the check or check_ functions.
https://docs.python.org/3/c-api/object.html#c.PyObject_Type
@InvincibleRMC it looks like you implemented these. What was the intent with the PyObject_Type check?
AI generated text from #6285
include/pybind11/typing.h:101: each argument load of typing::Union, Optional, Final, ClassVar, Literal or TypeVar leaks one reference to the type of the argument.
- These classes use PYBIND11_OBJECT_DEFAULT(..., PyObject_Type), and check_ discards the new reference that PyObject_Type returns.
- Fix: use the same check_ as the new typing::Object (h.ptr() != nullptr).
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression
- 主要言語
- C++
- スター
- 18k
- フォーク
- 2.3k
- 平均マージ
- 5日 7時間
- マージ済み PR(30日)
- 53
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pybind/pybind11 のほかの issue
-
triage
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
pybind/pybind11#5604 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 3 日以内に返信
-
docs
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
pybind/pybind11#747 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
array_t::at() returns a misaligned reference when the stride is not a multiple of alignof(T)対応中かも @henryiii が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 3 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 40/100
メンテナーはふだん 3 日以内に返信
pybind/pybind11 の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
patrick-hudson/put.gd-desktop#2044 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
uxlfoundation/oneDNN#6604 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: RoundToNearest truncates in plugins compiled with spcomp 1.13対応中かも @fmu1337 が今日担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
alliedmodders/sourcemod#2627 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信