Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-127443: add tool for linting Doc/data/refcounts.dat #127476

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

picnixz
Copy link
Contributor

@picnixz picnixz commented Dec 1, 2024

This tool can be used as follows:

python3.12 Tools/refcounts/lint.py  Doc/data/refcounts.dat
python3.12 Tools/refcounts/lint.py  Doc/data/refcounts.dat --abi Misc/stable_abi.toml

With the current file, I have something like: (three were missing in #127451, my bad, so I fixed them as well)

----------------------------------- PARSING ------------------------------------
----------------------------------- CHECKING -----------------------------------
  643  PyErr_NormalizeException[exc]                      missing reference count management
  644  PyErr_NormalizeException[val]                      missing reference count management
  645  PyErr_NormalizeException[tb]                       missing reference count management

Found 3 issues
Entries are not sorted

When I also include the stable ABI file, I have in addition (output truncated)

Found 3 issues
Entries are not sorted
----------------------------- CHECKING STABLE ABI ------------------------------
Stable ABI file: /home/picnix/lib/python/cpython/Misc/stable_abi.toml

Missing 232 stable ABI entries:
PyArg_Parse
PyArg_ParseTuple
PyArg_ParseTupleAndKeywords
PyArg_UnpackTuple
PyArg_VaParse
PyArg_VaParseTupleAndKeywords
PyArg_ValidateKeywordArguments
PyBuffer_FromContiguous
[...]

Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/.ruff.toml Outdated Show resolved Hide resolved
Tools/refcounts/mypy.ini Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
@picnixz picnixz marked this pull request as ready for review December 2, 2024 11:28
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I haven't reviewed the script as I know nothing about the refcounts.dat file, but the lint configs LGTM.

Tools/refcounts/.ruff.toml Outdated Show resolved Hide resolved
@picnixz
Copy link
Contributor Author

picnixz commented Dec 2, 2024

I don't think I'll change the configs. So thanks Alex for your review (and sorry for the request, I misclicked)! Now, I'll wait for Peter and Kirill's reviews concerning the script itself.

@AlexWaygood AlexWaygood removed their request for review December 2, 2024 12:10
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
.github/workflows/mypy.yml Outdated Show resolved Hide resolved
Tools/refcounts/lint.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants