summaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-02-17 07:03:05 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-02-17 07:03:05 (GMT)
commit54e5b89d77ca81f7d81010de288fb5c7d266af94 (patch)
tree307d3f748d1fe7294b49d941676c800093c2daf2 /Tools/scripts
parent41d97d677761032a12b1efdf1f61bec6b0b37235 (diff)
downloadcpython-54e5b89d77ca81f7d81010de288fb5c7d266af94.zip
cpython-54e5b89d77ca81f7d81010de288fb5c7d266af94.tar.gz
cpython-54e5b89d77ca81f7d81010de288fb5c7d266af94.tar.bz2
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.
Diffstat (limited to 'Tools/scripts')
-rw-r--r--Tools/scripts/reindent.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tools/scripts/reindent.py b/Tools/scripts/reindent.py
index e646aed..21c553b 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]