inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
2.97k stars 229 forks source link

ListBoxError scrolling to the bottom of the variables view #108

Open asmeurer opened 10 years ago

asmeurer commented 10 years ago

I got this scrolling to the bottom of the variables view

---------------------------------------------------------------------------
ListBoxError                              Traceback (most recent call last)
<ipython-input-4-95b84ed344a8> in <module>()
----> 1 build_BDD(l)

/Users/aaronmeurer/Documents/Continuum/conda/conda/logic.py in build_BDD(linear, sum, material_left)
    200     clauses += new_clauses
    201     ret, new_clauses = ITE(LA, hi, lo)
--> 202     clauses += new_clauses
    203
    204     return ret, new_clauses

/Users/aaronmeurer/Documents/Continuum/conda/conda/logic.py in build_BDD(linear, sum, material_left)
    200     clauses += new_clauses
    201     ret, new_clauses = ITE(LA, hi, lo)
--> 202     clauses += new_clauses
    203
    204     return ret, new_clauses

/Users/aaronmeurer/anaconda/lib/python3.3/bdb.py in trace_dispatch(self, frame, event, arg)
     45             return # None
     46         if event == 'line':
---> 47             return self.dispatch_line(frame)
     48         if event == 'call':
     49             return self.dispatch_call(frame, arg)

/Users/aaronmeurer/anaconda/lib/python3.3/bdb.py in dispatch_line(self, frame)
     63     def dispatch_line(self, frame):
     64         if self.stop_here(frame) or self.break_here(frame):
---> 65             self.user_line(frame)
     66             if self.quitting: raise BdbQuit
     67         return self.trace_dispatch

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/debugger.py in user_line(self, frame)
    320         self.ui.update_breakpoints()
    321
--> 322         self.interaction(frame)
    323
    324     def user_return(self, frame, return_value):

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/debugger.py in interaction(self, frame, exc_tuple, show_exc_dialog)
    288
    289         self.ui.call_with_ui(self.ui.interaction, exc_tuple,
--> 290                 show_exc_dialog=show_exc_dialog)
    291
    292     def get_stack_situation_id(self):

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/debugger.py in call_with_ui(self, f, *args, **kwargs)
   1834         self.show()
   1835         try:
-> 1836             return f(*args, **kwargs)
   1837         finally:
   1838             self.hide()

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/debugger.py in interaction(self, exc_tuple, show_exc_dialog)
   2012
   2013         self.caption.set_text(caption)
-> 2014         self.event_loop()
   2015
   2016     def set_source_code_provider(self, source_code_provider, force_update=False):

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/debugger.py in event_loop(self, toplevel)
   1978                         self.size = self.screen.get_cols_rows()
   1979                     else:
-> 1980                         toplevel.keypress(self.size, k)
   1981
   1982             return self.quit_event_loop

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/ui_tools.py in keypress(self, size, key)
     81
     82         if result is not None:
---> 83             result = self._w.keypress(size, key)
     84
     85         if result is not None and not self.is_preemptive:

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/urwid/container.py in keypress(self, size, key)
   1101         if not self.body.selectable():
   1102             return key
-> 1103         return self.body.keypress( (maxcol, remaining), key )
   1104
   1105

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/urwid/container.py in keypress(self, size, key)
   2239             key = w.keypress((mc, self.rows(size, True)), key)
   2240         else:
-> 2241             key = w.keypress((mc,) + size[1:], key)
   2242
   2243         if self._command_map[key] not in ('cursor left', 'cursor right'):

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/ui_tools.py in keypress(self, size, key)
     81
     82         if result is not None:
---> 83             result = self._w.keypress(size, key)
     84
     85         if result is not None and not self.is_preemptive:

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/urwid/container.py in keypress(self, size, key)
   1558         if self.selectable():
   1559             tsize = self.get_item_size(size, i, True, item_rows)
-> 1560             key = self.focus.keypress(tsize, key)
   1561             if self._command_map[key] not in ('cursor up', 'cursor down'):
   1562                 return key

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/urwid/container.py in keypress(self, size, key)
   1558         if self.selectable():
   1559             tsize = self.get_item_size(size, i, True, item_rows)
-> 1560             key = self.focus.keypress(tsize, key)
   1561             if self._command_map[key] not in ('cursor up', 'cursor down'):
   1562                 return key

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/pudb/ui_tools.py in keypress(self, size, key)
     81
     82         if result is not None:
---> 83             result = self._w.keypress(size, key)
     84
     85         if result is not None and not self.is_preemptive:

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/urwid/listbox.py in keypress(self, size, key)
    997
    998         if self._command_map[key] == CURSOR_DOWN:
--> 999             return actual_key(self._keypress_down((maxcol, maxrow)))
   1000
   1001         if self._command_map[key] == CURSOR_PAGE_UP:

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/urwid/listbox.py in _keypress_down(self, size)
   1132             if widget is None:
   1133                 self.shift_focus((maxcol,maxrow),
-> 1134                     row_offset-rows)
   1135                 return
   1136             # FIXME: catch this bug in testcase

/Users/aaronmeurer/anaconda/lib/python3.3/site-packages/urwid/listbox.py in shift_focus(self, size, offset_inset)
    778             tgt_rows = target.rows( (maxcol,), True )
    779             if offset_inset + tgt_rows <= 0:
--> 780                 raise ListBoxError("Invalid offset_inset: %r, only %r rows in target!" %(offset_inset, tgt_rows))
    781             self.offset_rows = 0
    782             self.inset_fraction = (-offset_inset,tgt_rows)

ListBoxError: Invalid offset_inset: -1, only 1 rows in target!

Here is my pudb.cfg:

[pudb]
breakpoints_height = 0.0267918337155
breakpoints_weight = 0.20971520000000005
current_stack_frame = bottom
custom_stringifier = ~/Documents/pudb/example-stringifier.py
custom_theme = ~/Documents/pudb/example-theme.py
display = auto
line_numbers = True
prompt_on_quit = True
seen_welcome = e019
shell = classic
sidebar_width = 0.390625
stack_height = 0.0368045127061
stack_weight = 0.16777216000000003
stringifier = str
theme = midnight
variables_height = 0.936403653578
variables_weight = 5.96046447753
wrap_variables = True

My terminal is 40 lines by 141 columns.

inducer commented 10 years ago

Can't reproduce. Can you post more precise steps? Also, what version of Urwid?

asmeurer commented 10 years ago

The length of the variable view was probably relevant. I think it was one or so more than what would fit on the screen. I also had a few classes expanded. Urwid version should be 1.1.1. Is there a newer one?

I was in Python 3.3 too.

I just noticed that the bulk of the traceback is in urwid. So this was likely an urwid bug. Feel free to close if you still can't reproduce and don't see an obvious fix.

inducer commented 10 years ago

There's Urwid 1.2 out. Can you try with that?

asmeurer commented 10 years ago

I doubt I can even reproduce this. I'll just close it and reopen it if I see it again.

asmeurer commented 10 years ago

Turns out it's easy to reproduce, and Urwid 1.2 does not fix it. Just press s press the down arrow. The issue is with those settings, the stack and the breakpoints view are 0 rows high.