5555# A specified newline to be used in the output (set by --newline option)
5656spec_newline = None
5757
58+ ALLOWLIST_TABS = {
59+ "Tools/c-analyzer/cpython/_parser.py" ,
60+ }
61+
5862
5963def usage (msg = None ):
6064 if msg is None :
@@ -125,7 +129,7 @@ def check(file):
125129 return
126130 try :
127131 with open (file , encoding = encoding ) as f :
128- r = Reindenter (f )
132+ r = Reindenter (f , file )
129133 except IOError as msg :
130134 errprint ("%s: I/O Error: %s" % (file , str (msg )))
131135 return
@@ -173,7 +177,7 @@ def _rstrip(line, JUNK='\n \t'):
173177
174178class Reindenter :
175179
176- def __init__ (self , f ):
180+ def __init__ (self , f , filename = None ):
177181 self .find_stmt = 1 # next token begins a fresh stmt?
178182 self .level = 0 # current indent level
179183
@@ -183,8 +187,16 @@ def __init__(self, f):
183187 # File lines, rstripped & tab-expanded. Dummy at start is so
184188 # that we can use tokenize's 1-based line numbering easily.
185189 # Note that a line is all-blank iff it's "\n".
186- self .lines = [_rstrip (line ).expandtabs () + "\n "
187- for line in self .raw ]
190+ self .lines = [
191+ (
192+ _rstrip (line )
193+ if filename in ALLOWLIST_TABS
194+ else _rstrip (line ).expandtabs ()
195+ )
196+ + "\n "
197+ for line in self .raw
198+ ]
199+
188200 self .lines .insert (0 , None )
189201 self .index = 1 # index into self.lines of next line
190202
0 commit comments