python / python/cpython

Improve and maintain `Doc/data/refcounts.dat`

Abierto
#127,443 30 comentarios 4 reacciones 1 asignado Ver en GitHub

@picnixz ya está trabajando en esto.

Desde el 30/11/2024.

docs
Lenguaje dominante
Python
Estrellas
77.2k
Forks
36k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

The Doc/data/refcounts.dat file is sometimes updated and sometimes not. I suggest we try to make it up-to-date as much as possible, at least by adding the functions part of the stable ABI.

In addition, the entries are not sorted alphabetically. While they are semantically sorted, it does not help when adding new entries (where should we put it?). So I suggest to reformat the file once I'm done with adding the new entries.

Finally, I suggest adding a small script that checks whether the file is up-to-date, at least by checking whether the stable ABI is a subset of that file and whether the refcounts.dat is sorted or not (again it will be part of a CI workflow).

The main motivation behind this is to help newcomers in understanding whether a reference is borrowed or not (sometimes the comment doesn't say anything). It could also help in managing a future linter. Note that we have no syntax to indicate whether a reference is stolen or not so we should also improve that part.

cc @vstinner @encukou @Eclips4 @ZeroIntensity

Linked PRs
  • gh-127444
  • gh-127451
  • gh-127496
  • gh-127497
  • gh-127468
  • gh-127476
### Tasks
- [x] Add refcounts entries from the stable ABI (only func entries)
- [x] Allow to specify when a reference is stolen (use "$" instead of "0")
- [x] Add a script for checking whether the file is correctly formatted (check order, syntax, but not advanced format)
- [x] Add a script for checking if the file is up-to-date when a new function is added to the Stable ABI
- [ ] Unify format (sort entries, add blank lines, add space before pointer dereference marker (optional, likely not))
- [ ] Add CI jobs
- [ ] Use a script to auto-generate the refcounts.dat and let the developer fill out the entries

Guía de contribución

Abrir la guía de contribución

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.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.