From: Michael W. Hudson Date: Fri, 22 Feb 2002 13:30:17 +0000 (+0000) Subject: backport tim_one's checkin of X-Git-Tag: v2.2.1c1~192 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a9793cb94af64d782075fb3a1a4514527c8ee334;p=thirdparty%2FPython%2Fcpython.git backport tim_one's checkin of revision 1.3 of reindent.py SF bug #497839: reindent chokes on empty first lines. Reindenter.run(): copy over initial all-whitespace lines (if any, and after normalizing to remove trailing blanks and tabs). Bugfix candidate. --- diff --git a/Tools/scripts/reindent.py b/Tools/scripts/reindent.py index e646aed9c3ce..21c553b7f805 100644 --- a/Tools/scripts/reindent.py +++ b/Tools/scripts/reindent.py @@ -157,6 +157,10 @@ class Reindenter: have2want = {} # Program after transformation. after = self.after = [] + # Copy over initial empty lines -- there's nothing to do until + # we see a line with *something* on it. + i = stats[0][0] + after.extend(lines[1:i]) for i in range(len(stats)-1): thisstmt, thislevel = stats[i] nextstmt = stats[i+1][0]