[Python-checkins] gh-103334: Ignore `Tools/c-analyzer/cpython/_parser.py` from `patchcheck` (GH-103335)

miss-islington webhook-mailer at python.org
Mon Apr 10 10:58:54 EDT 2023


https://github.com/python/cpython/commit/40db5c65b7ca4e784613b6122106a92576aba2d6
commit: 40db5c65b7ca4e784613b6122106a92576aba2d6
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2023-04-10T07:58:48-07:00
summary:

gh-103334: Ignore `Tools/c-analyzer/cpython/_parser.py` from `patchcheck` (GH-103335)



I've also added a small comment to `Tools/c-analyzer/cpython/_parser.py` to trigger the `patchcheck` CI. It must pass now.

Automerge-Triggered-By: GH:ericsnowcurrently

files:
M Tools/c-analyzer/cpython/_parser.py
M Tools/patchcheck/patchcheck.py

diff --git a/Tools/c-analyzer/cpython/_parser.py b/Tools/c-analyzer/cpython/_parser.py
index acf30e2c4020..d82fb967297c 100644
--- a/Tools/c-analyzer/cpython/_parser.py
+++ b/Tools/c-analyzer/cpython/_parser.py
@@ -47,6 +47,7 @@ def clean_lines(text):
 '''
 
 # XXX Handle these.
+# Tab separated:
 EXCLUDED = clean_lines('''
 # @begin=conf@
 
diff --git a/Tools/patchcheck/patchcheck.py b/Tools/patchcheck/patchcheck.py
index 44a6fb8c660c..fa3a43af6e60 100755
--- a/Tools/patchcheck/patchcheck.py
+++ b/Tools/patchcheck/patchcheck.py
@@ -170,12 +170,24 @@ def report_modified_files(file_paths):
         return "\n".join(lines)
 
 
+#: Python files that have tabs by design:
+_PYTHON_FILES_WITH_TABS = frozenset({
+    'Tools/c-analyzer/cpython/_parser.py',
+})
+
+
 @status("Fixing Python file whitespace", info=report_modified_files)
 def normalize_whitespace(file_paths):
     """Make sure that the whitespace for .py files have been normalized."""
     reindent.makebackup = False  # No need to create backups.
-    fixed = [path for path in file_paths if path.endswith('.py') and
-             reindent.check(os.path.join(SRCDIR, path))]
+    fixed = [
+        path for path in file_paths
+        if (
+            path.endswith('.py')
+            and path not in _PYTHON_FILES_WITH_TABS
+            and reindent.check(os.path.join(SRCDIR, path))
+        )
+    ]
     return fixed
 
 



More information about the Python-checkins mailing list