Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Python] Compiler annotations for ownership semantics

Abierto
#21,618 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@aaronj0 ya está trabajando en esto.

Desde el 16/3/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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.
Lenguaje dominante
C++
Estrellas
3.3k
Forks
1.6k
Merge medio
2 d 17 h
PR fusionados (30 d)
188

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de root-project/root

Todos los issues de root-project/root

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.