inducer / pudb

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

(SEPARATOR) AttributeError: 'AttrMap' object has no attribute 'id_path' #167

Open jsoref opened 8 years ago

jsoref commented 8 years ago

I'm using watches, and stepping using continue (c)...

  File "/usr/lib64/python2.7/bdb.py", line 49, in trace_dispatch
    return self.dispatch_line(frame)
  File "pudb/debugger.py", line 173, in dispatch_line
    self.user_line(frame)
  File "pudb/debugger.py", line 371, in user_line
    self.interaction(frame)
  File "pudb/debugger.py", line 339, in interaction
    show_exc_dialog=show_exc_dialog)
  File "pudb/debugger.py", line 2059, in call_with_ui
    return f(*args, **kwargs)
  File "pudb/debugger.py", line 2269, in interaction
    self.event_loop()
  File "pudb/debugger.py", line 2235, in event_loop
    toplevel.keypress(self.size, k)
  File "pudb/ui_tools.py", line 83, in keypress
    result = self._w.keypress(size, key)
  File "urwid/container.py", line 1128, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "urwid/container.py", line 2269, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "pudb/ui_tools.py", line 83, in keypress
    result = self._w.keypress(size, key)
  File "urwid/container.py", line 1587, in keypress
    key = self.focus.keypress(tsize, key)
  File "urwid/container.py", line 1587, in keypress
    key = self.focus.keypress(tsize, key)
  File "pudb/ui_tools.py", line 88, in keypress
    return handler(self, size, key)
  File "pudb/debugger.py", line 754, in change_var_state
    .get_inspect_info(var.id_path, read_only=False)
AttributeError: 'AttrMap' object has no attribute 'id_path'
>>> var.get_attr_map()
{None: 'variable separator'}
>>> key
'c'
SEPARATOR = urwid.AttrMap(urwid.Text(""), "variable separator")
inducer commented 8 years ago

I can't make heads or tails of what you're saying. What were you doing? What happened? At any rate, this looks like it might be related to the custom stringifier stuff from #164.

jsoref commented 8 years ago

I used n to add some watches, and I used c to continue through some code.

At some point, it crashed (according to key, I had recently pressed c), w/ the stack listed.

The var object which does not have an id_path is actually the SEPARATOR defined in var_view.py.

I don't have a custom stringifier set up in preferences.

jsoref commented 8 years ago
  File "/home/timeless/hg/py/lib/python2.7/site-packages/pudb-2015.4.2-py2.7.egg/pudb/debugger.py", line 754, in change_var_state
    .get_inspect_info(var.id_path, read_only=False)
AttributeError: 'NoneType' object has no attribute 'id_path'

I just hit this again. I'm basically stepping (often using c or f -- probably f this time).

I think a try block would be helpful, something like: try: iinfo = self.get_frame_var_info(read_only=False) \ .get_inspect_info(var.id_path, read_only=False) except AttributeError:

return? remove something ??

I can't quite figure out what to put into the except block... (I can't figure out what's managing what)

inducer commented 8 years ago

A bunch of things don't make sense here.

If you're looking for a recovery path, simply returning from change_var_state should be OK, but that doesn't explain at all what's going on here. It would help a lot if you could figure out a solid reproducer.

jsoref commented 8 years ago

@inducer : is there a way to add some logging (would script work?) so that we could debug this? I'd really prefer to give you whatever is necessary to be confident in the fix...

inducer commented 8 years ago

You can direct the Debugger UI to a separate PTY. (Debugger takes stdin and stdout arguments.)