python / python/cpython

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

Ouverte
#127,443 30 commentaires 4 réactions 1 personne assignée Voir sur GitHub

@picnixz y travaille déjà.

Depuis le 30/11/2024.

docs
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.