python / python/cpython

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

Offen
#127,443 30 Kommentare 4 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@picnixz arbeitet bereits daran.

Seit 30.11.2024.

docs
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
36k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.