Nic0 / tyrs

Twitter and Identica client using curses
http://tyrs.nicosphere.net
61 stars 10 forks source link

IndexError in Timeline when retrieving new events. #114

Open kezabelle opened 12 years ago

kezabelle commented 12 years ago

Can't easily figure out how to re-produce it, short of writing some abstruse testcase to demonstrate that somehow, there can exist a discrepancy between what's in self.walker and retreive that can result in the following traceback, specifically when enumerating over retreive and testing the id isn't seen in self.walker

File "build/bdist.macosx-10.6-universal/egg/tyrs/tyrs.py", line 66, in main
  File "build/bdist.macosx-10.6-universal/egg/tyrs/tyrs.py", line 71, in init_tyrs
  File "build/bdist.macosx-10.6-universal/egg/tyrs/tyrs.py", line 88, in init_interface
  File "build/bdist.macosx-10.6-universal/egg/tyrs/interface.py", line 49, in __init__
  File "build/bdist.macosx-10.6-universal/egg/tyrs/interface.py", line 62, in main_loop
  File "/Library/Python/2.6/site-packages/urwid/main_loop.py", line 170, in run
    self.screen.run_wrapper(self._run)
  File "/Library/Python/2.6/site-packages/urwid/raw_display.py", line 234, in run_wrapper
    return fn()
  File "/Library/Python/2.6/site-packages/urwid/main_loop.py", line 188, in _run
    self.event_loop.run()
  File "/Library/Python/2.6/site-packages/urwid/main_loop.py", line 498, in run
    self._loop()
  File "/Library/Python/2.6/site-packages/urwid/main_loop.py", line 523, in _loop
    self._watch_files[fd]()
  File "/Library/Python/2.6/site-packages/urwid/main_loop.py", line 234, in _update
    self.process_input(keys)
  File "/Library/Python/2.6/site-packages/urwid/main_loop.py", line 323, in process_input
    self.unhandled_input(k)
  File "/Library/Python/2.6/site-packages/urwid/main_loop.py", line 350, in unhandled_input
    return self._unhandled_input(input)
  File "build/bdist.macosx-10.6-universal/egg/tyrs/keys.py", line 53, in keystroke
  File "build/bdist.macosx-10.6-universal/egg/tyrs/tweets.py", line 210, in update_timeline
  File "build/bdist.macosx-10.6-universal/egg/tyrs/timeline.py", line 42, in append_new_statuses
  File "build/bdist.macosx-10.6-universal/egg/tyrs/timeline.py", line 53, in add_to_walker
IndexError: list index out of range

The relevant section of code being:

for i, status in enumerate(retreive):
    # New statuses are insert
    if status.id == self.cleared:
        return
    while status.id != self.walker[0+i].id:

Sidenote: both append_new_statuses and add_to_walker use a local variable called retreive, a typo for retrieve.

This was experienced against master, with all dependencies (except setuptools) being freshly installed when doing python setup.py install