[Python-bugs-list] [ python-Bugs-497839 ] reindent chokes on empty first lines

noreply@sourceforge.net noreply@sourceforge.net
Sat, 16 Feb 2002 23:04:19 -0800


Bugs item #497839, was opened at 2001-12-30 04:04
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=497839&group_id=5470

Category: Demos and Tools
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Martin v. Löwis (loewis)
Assigned to: Tim Peters (tim_one)
Summary: reindent chokes on empty first lines

Initial Comment:
If a file has an empty first line, and a hanging
comment, reindent crashes. For the attached file, I get

Traceback (most recent call last):
  File "/usr/src/python/Tools/scripts/reindent.py",
line 271, in ?
    main()
  File "/usr/src/python/Tools/scripts/reindent.py",
line 65, in main
    check(arg)
  File "/usr/src/python/Tools/scripts/reindent.py",
line 90, in check
    if r.run():
  File "/usr/src/python/Tools/scripts/reindent.py",
line 187, in run
    want = have + getlspace(after[jline-1]) - \
IndexError: list index out of range


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2002-02-16 23:04

Message:
Logged In: YES 
user_id=31435

Thanks for whittling this down!  reindent wasn't expecting 
all-whitespace lines at the start of a file.  That bad 
assumption is now repaired, in

Tools/scripts/reindent.py; new revision: 1.3

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=497839&group_id=5470