pudb icon indicating copy to clipboard operation
pudb copied to clipboard

Crash on editing Variable settings

Open eugenezastrogin opened this issue 8 years ago • 2 comments

Crashes on certain repeatable sequence of actions. Steps to reproduce:

  1. load http://ideone.com/DVs5cv
  2. start pudb (pudb3 script.py)
  3. Run till the end (repeated n, then examine post-mortem mode)
  4. Switch to Variables (V)
  5. Press enter on any Variable in the list

Traceback:

Traceback (most recent call last):
  File "/usr/bin/pudb3", line 11, in <module>
    load_entry_point('pudb==2017.1.1', 'console_scripts', 'pudb3')()
  File "/usr/lib/python3.6/site-packages/pudb/run.py", line 32, in main
    steal_output=options.steal_output)
  File "/usr/lib/python3.6/site-packages/pudb/__init__.py", line 127, in runscript
    dbg.interaction(None, sys.exc_info(), show_exc_dialog=False)
  File "/usr/lib/python3.6/site-packages/pudb/debugger.py", line 339, in interaction
    show_exc_dialog=show_exc_dialog)
  File "/usr/lib/python3.6/site-packages/pudb/debugger.py", line 2079, in call_with_ui
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pudb/debugger.py", line 2307, in interaction
    self.event_loop()
  File "/usr/lib/python3.6/site-packages/pudb/debugger.py", line 2273, in event_loop
    toplevel.keypress(self.size, k)
  File "/usr/lib/python3.6/site-packages/pudb/ui_tools.py", line 96, in keypress
    result = self._w.keypress(size, key)
  File "/usr/lib64/python3.6/site-packages/urwid/container.py", line 1128, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "/usr/lib64/python3.6/site-packages/urwid/container.py", line 2269, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "/usr/lib/python3.6/site-packages/pudb/ui_tools.py", line 96, in keypress
    result = self._w.keypress(size, key)
  File "/usr/lib64/python3.6/site-packages/urwid/container.py", line 1587, in keypress
    key = self.focus.keypress(tsize, key)
  File "/usr/lib64/python3.6/site-packages/urwid/container.py", line 1587, in keypress
    key = self.focus.keypress(tsize, key)
  File "/usr/lib/python3.6/site-packages/pudb/ui_tools.py", line 101, in keypress
    return handler(self, size, key)
  File "/usr/lib/python3.6/site-packages/pudb/debugger.py", line 789, in edit_inspector_detail
    fvi = self.get_frame_var_info(read_only=False)
  File "/usr/lib/python3.6/site-packages/pudb/var_view.py", line 536, in get_frame_var_info
    ssid = self.debugger.get_stack_situation_id()
  File "/usr/lib/python3.6/site-packages/pudb/debugger.py", line 342, in get_stack_situation_id
    return str(id(self.stack[self.curindex][0].f_code))
IndexError: list index out of range

eugenezastrogin avatar Apr 01 '17 07:04 eugenezastrogin

Seems to happen with any script examining a variable in post-mortem mode.

asmeurer avatar Apr 01 '17 08:04 asmeurer

This is because when in post-mortem Debugger.stack is empty.

I can make it not crash by restoring Debugger.bottom_frame to Debugger.stack in post-mortem. However, at that point you can only inspect attributes of the module object itself, which in this case are a function and 2 classes (checkio, Wall, and WallPart)

qhuy4119 avatar Jul 14 '21 02:07 qhuy4119