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-127443: Update refcounts data with stable ABI functions. #127444
- gh-127443: fix some entries in
Doc/data/refcounts.dat
#127451 - [3.13] gh-127443: Fix some entries in
Doc/data/refcounts.dat
(GH-127451) #127496 - [3.12] gh-127443: Fix some entries in
Doc/data/refcounts.dat
(GH-127451) #127497 - gh-127443: Add semantics for stolen references in
Doc/data/refcounts.dat
#127468 - gh-127443: add tool for linting
Doc/data/refcounts.dat
#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
Metadata
Metadata
Assignees
Projects
Status