gh-141376: make smelly: List all symbols, repeat smelly ones at end#141394
gh-141376: make smelly: List all symbols, repeat smelly ones at end#141394encukou merged 8 commits intopython:mainfrom
Conversation
|
@AA-Turner @hugovk How can I inform precommit that |
vstinner
left a comment
There was a problem hiding this comment.
Instead of colors, I would prefer to not print each tested binary unless if has "smelly" symbols.
Add this to diff --git a/Tools/build/.ruff.toml b/Tools/build/.ruff.toml
index 996f725fdcb..e7852abe131 100644
--- a/Tools/build/.ruff.toml
+++ b/Tools/build/.ruff.toml
@@ -31,6 +31,9 @@ ignore = [
"PYI025", # Use `from collections.abc import Set as AbstractSet`
]
+[lint.isort]
+extra-standard-library = ["_colorize"]
+
[lint.per-file-ignores]
"{check_extension_modules,freeze_modules}.py" = [
"UP031", # Use format specifiers instead of percent formatDocs: https://docs.astral.sh/ruff/settings/#lint_isort_extra-standard-library And note it'll stick it first in the stdlib import list. |
First gather data, then present the results.
|
@hugovk, thanks! Maybe I'll not need it here but hopefully I'll remember next time. @vstinner, would you be OK with something like https://github.com/encukou/cpython/blob/make-smelly-refactor/Tools/build/smelly.py ? |
Yes, something like that 👍 |
|
OK; I've changed the script to instead:
This way it's fine without colours! |
|
This version includes removing exceptions (as in #141392). |
Oh. I expected the opposite: only display smelly symbols and be silent if a binary has no smelly symbols.
|
|
It's more verbose, but that part scrolls up on a terminal; the important part is at the end so it stays visible. |
|
Would it be possible/make sense to add a command line option to control if Python symbols are displayed or not? And don't show up Python symbols by default? |
|
OK, here it is. |
|
I tested the change with: diff --git a/Objects/object.c b/Objects/object.c
index 4fc692bb029..9176f3522f4 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -893,7 +893,7 @@ PyObject_Bytes(PyObject *v)
return PyBytes_FromObject(v);
}
-static void
+void
clear_freelist(struct _Py_freelist *freelist, int is_finalization,
freefunc dofree)
{
@@ -908,7 +908,7 @@ clear_freelist(struct _Py_freelist *freelist, int is_finalization,
}
}
-static void
+void
free_object(void *obj)
{
PyObject *op = (PyObject *)obj;The script works as expected: The (default) output is now short and readable! The verbose output is, well, more verbose :-) |
… with --verbose (pythonGH-141394) Instead of long and uninteresting output for all checked libraries, only print found issues by default. Add a new -v/--verbose option to list all symbols (useful for checking that the script finds the symbols).
Without colours, the script's output hard to scan for my spoiled eyes.
The messages are adjusted to no longer imply a lack of exceptions to the rules.
(This PR is not tightly related to #141376 but I think it's best to attach it to that issue.)