Repository navigation
make patchcheck: Allow Tabs in Some Cases #92266
Description
Activity
- changed the title
[-]make patchcheck: Allow tabs in some cases.[/-][+]make patchcheck: Allow Tabs in Some Cases[/+]on May 3, 2022 Why not to use
\tinstead of literal tab?I think this is the mentioned table:
cpython/Tools/c-analyzer/cpython/_parser.py
Lines 130 to 141 in d20bb33
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.tsvfile?Here
\ts would make it less readable.Correct.
Would it make sense to move that to a stand-alone
.tsvfile?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.
Reacted by Ezio Melottiericsnowcurrently commented
on Mar 16, 2023 MemberAuthorMore actionsCC @AlexWaygood
Reacted by Alex Waygood- addedbuildThe build process and cross-buildThe build process and cross-build
on Nov 27, 2023 Up to now I've basically ignored CI failures (from
make patchcheck) in _parser.pyTools/patchcheck/reindent.pyis no longer run as part ofmake patchcheck, andpatchcheckis no longer run on the CI.reindent.pyincludes a few lints:- strip trailing whitespace (now done by
trailing-whitespacein 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.pyto an allowlist inreindent.pyso its tabs are not changed. But asreindent.pyis 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.Reacted by Eric Snow- strip trailing whitespace (now done by
- added a commit that references this issue
on Jun 27, 2025 - addedtype-featureA feature request or enhancementA feature request or enhancement
on Jun 27, 2025 - added a commit that references this issue
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- added a commit that references this issue
on Oct 1, 2025 - added a commit that references this issue
on Oct 7, 2025
Currently 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
c-analyzer/cpython/_parser.py#137622c-analyzer/cpython/_parser.py(GH-137622) #139718Footnotes
reindent.check()is used by Tools/patchcheck/patchcheck.py (AKAmake patchcheck). ↩Addressing trailing-tabs-in-str-literals is even more relevant since I enabled the check-c-globals CI check. For example, see https://github.com/python/cpython/pull/102735#issuecomment-1470516458. ↩