[Python-checkins] CVS: python/dist/src/Tools/scripts reindent.py,1.2,1.2.10.1

Michael Hudson mwh@users.sourceforge.net
Fri, 22 Feb 2002 05:30:19 -0800


Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv17278

Modified Files:
      Tag: release22-maint
	reindent.py 
Log Message:
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.


Index: reindent.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/reindent.py,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -C2 -d -r1.2 -r1.2.10.1
*** reindent.py	4 Oct 2001 19:44:10 -0000	1.2
--- reindent.py	22 Feb 2002 13:30:17 -0000	1.2.10.1
***************
*** 158,161 ****
--- 158,165 ----
          # 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]