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

make patchcheck: Allow Tabs in Some Cases #92266

Open
ericsnowcurrently opened this issue May 3, 2022 · 4 comments
Open

make patchcheck: Allow Tabs in Some Cases #92266

ericsnowcurrently opened this issue May 3, 2022 · 4 comments
Labels
build The build process and cross-build

Comments

@ericsnowcurrently
Copy link
Member

ericsnowcurrently commented May 3, 2022

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.

Footnotes

  1. reindent.check() is used by Tools/patchcheck/patchcheck.py (AKA make patchcheck).

  2. 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.

@ericsnowcurrently ericsnowcurrently changed the title make patchcheck: Allow tabs in some cases. make patchcheck: Allow Tabs in Some Cases May 3, 2022
@serhiy-storchaka
Copy link
Member

Why not to use \t instead of literal tab?

@ezio-melotti
Copy link
Member

ezio-melotti commented 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
Copy link
Member Author

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
Copy link
Member Author

CC @AlexWaygood

@iritkatriel iritkatriel added the build The build process and cross-build label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build
Projects
None yet
Development

No branches or pull requests

4 participants