Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Python] Compiler annotations for ownership semantics

オープン
#21,618 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@aaronj0 がすでに取り組んでいます。

2026年3月16日 から。

評価

この issue はまだ評価されていません。

説明

in:Python Interface new feature
Feature description

It would be great if ownership semantics can be communicated in the C++ source code via annotations, so we don't have to write Pythonizations by hand just for this, and carefully keep them in sync with the behavior of the C++ code.

This is relevant for both arguments and return values.

For arguments, we need something to indicate ownership adoption (_transfer_ownership is just a placeholder name to illustrate the idea):

void foo(TObject * _transfer_ownership obj) {
   std::unique_ptr<TObject>{obj};
}

For return values, we need something to indicate ownership on the caller side (_caller_owns is again just a placeholder):

TObject *_caller_owns bar() {
   return new TObject{};
}

Object ownership problems come up often on the forum (example post), so having a robust way to convey the correct ownership semantics would be a game changer for the robustness of the ROOT Python interfaces.

Alternatives considered
  • Manual Pythonizations like in ee79dfd85c2f, but this doesn't scale well.
  • Migrating C++ interfaces to smart pointers, but this would break backwards compatibility.
主要言語
C++
スター
3.3k
フォーク
1.6k
平均マージ
2日 17時間
マージ済み PR(30日)
188

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

root-project/root のほかの issue

root-project/root の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。