GeezerVison is showing github.com — make patchcheck: Allow Tabs in Some Cases · Issue #92266 · python/cpython
make patchcheck: Allow Tabs in Some Cases #92266DescriptionCurrently Tools/patchcheck/reindent.py1 replaces all tabs with spaces. However, in Tools/c-analyzer/cpython._parser.py there are embedded tab-based tables. Up to now I've basically ignored CI failures (from make patchcheck) in _parser.py, but I'd rather reindent.py be a little smarter (even if just a whitelist). 2 Tools/scripts/untabify.py sounds like it may have a similar story.
Linked PRs
Activitychanged the title [-]make patchcheck: Allow tabs in some cases.[/-] [+]make patchcheck: Allow Tabs in Some Cases[/+] on May 3, 2022serhiy-storchaka commented on May 4, 2022 Why not to use \t instead of literal tab? ezio-melotti commented on May 4, 2022 I think this is the mentioned table:
|
|
|
MACROS = clean_lines(''' |
|
# @begin=tsv@ |
|
|
|
glob name value |
|
|
|
Include/internal/*.h Py_BUILD_CORE 1 |
|
Python/**/*.c Py_BUILD_CORE 1 |
|
Parser/**/*.c Py_BUILD_CORE 1 |
|
Objects/**/*.c Py_BUILD_CORE 1 |
|
|
|
Modules/_asynciomodule.c Py_BUILD_CORE 1 |
Here \ts would make it less readable. Would it make sense to move that to a stand-alone .tsv file? ericsnowcurrently commented on May 5, 2022
Here \ts would make it less readable.
Correct.
Would it make sense to move that to a stand-alone .tsv file?
I considered that but didn't have time to try it out. I'd rather have that particular data stay in the current file if possible though. One alternative is to switch to csv. I don't recall that these specific tables need tsv. ericsnowcurrently commented on Mar 16, 2023 hugovk commented on Jun 26, 2025
Up to now I've basically ignored CI failures (from make patchcheck) in _parser.py
Tools/patchcheck/reindent.py is no longer run as part of make patchcheck, and patchcheck is no longer run on the CI.
reindent.py includes a few lints:
- strip trailing whitespace (now done by
trailing-whitespace in CI via pre-commit)
- replace tabs with spaces
- reindent to multiples of four-space indents
PR #135983 re-adds the second of these to the CI via pre-commit.
but I'd rather reindent.py be a little smarter (even if just a whitelist).
PR #135984 adds Tools/c-analyzer/cpython/_parser.py to an allowlist in reindent.py so its tabs are not changed. But as reindent.py is no longer part of the CI, and therefore less often run, this is less pressing.
Tools/scripts/untabify.py sounds like it may have a similar story.
It does. We could easily add an allowlist here too, possibly shared with reindent.py. However, this is not run by the CI, by any make commands, nor is recommended by the devguide, so I've not changed it. added a commit that references this issue on Sep 17, 2025GH-92266: Remove embedded tabs from ``c-analyzer/cpython/_parser.py`` (… AA-Turner commented on Sep 17, 2025 The tabs have been removed from Tools/c-analyzer/cpython/_parser.py & there are no other instances, as far as I'm aware. Going forwards, I think we should just avoid embedded tabs.
A Reacted by Eric Snow and Hugo van Kemenade
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|