You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
Activity
[-]make patchcheck: Allow tabs in some cases.[/-][+]make patchcheck: Allow Tabs in Some Cases[/+]serhiy-storchaka commentedon May 4, 2022
Why not to use
\tinstead of literal tab?ezio-melotti commentedon May 4, 2022
I think this is the mentioned table:
cpython/Tools/c-analyzer/cpython/_parser.py
Lines 130 to 141 in d20bb33
Here
\ts would make it less readable. Would it make sense to move that to a stand-alone.tsvfile?ericsnowcurrently commentedon May 5, 2022
Correct.
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 commentedon Mar 16, 2023
CC @AlexWaygood
hugovk commentedon Jun 26, 2025
Tools/patchcheck/reindent.pyis no longer run as part ofmake patchcheck, andpatchcheckis no longer run on the CI.reindent.pyincludes a few lints:trailing-whitespacein CI via pre-commit)PR #135983 re-adds the second of these to the CI via pre-commit.
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.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.gh-92266: Replace tabs with four spaces in Python files (#135983)
pythongh-92266: Replace tabs with four spaces in Python files (python…
pythongh-92266: Replace tabs with four spaces in Python files (python…
[3.14] gh-92266: Replace tabs with four spaces in Python files (GH-13…
[3.13] gh-92266: Replace tabs with four spaces in Python files (GH-13…
pythongh-92266: Replace tabs with four spaces in Python files (python…
pythongh-92266: Replace tabs with four spaces in Python files (python…
pythongh-92266: Replace tabs with four spaces in Python files (python…
pythongh-92266: Replace tabs with four spaces in Python files (python…
GH-92266: Remove embedded tabs from ``c-analyzer/cpython/_parser.py`` (…
AA-Turner commentedon 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
gh-92266: Update pre-commit (#139411)
pythongh-92266: Update pre-commit (pythonGH-139411)
pythonGH-92266: Remove embedded tabs from ``c-analyzer/cpython/_parse…
[3.14] GH-92266: Remove embedded tabs from ``c-analyzer/cpython/_pars…
[3.14] gh-92266: Update pre-commit (GH-139411) (#139466)
[3.13] pythongh-92266: Update pre-commit (pythonGH-139411)
[3.13] gh-92266: Update pre-commit (GH-139411) (#139760)