cansarigol/pdbr

Ipython 8.0

phgz opened this issue · 2 comments

phgz commented

Hi,

Do you plan on supporting Ipython 8.0? I tried it with pdbr and the only issue (as I'm aware of) was a

Traceback (most recent call last):
  File "....py", line 234, in <module>
    f(0)
  File "....py", line 126, in ...
    breakpoint()
  File ".../pdbr/__main__.py", line 13, in set_trace
    pdb_cls = _pdbr_cls(context=context, show_layouts=show_layouts)
  File ".../pdbr/utils.py", line 92, in _pdbr_cls
    return klass()
  File ".../pdbr/_pdbr.py", line 72, in __init__
    super().__init__(**init_kwargs)
  File ".../IPython/terminal/debugger.py", line 29, in __init__
    self.pt_init(pt_session_options)
  File ".../pdbr/_pdbr.py", line 84, in pt_init
    func(pt_session_options)
  File ".../IPython/terminal/debugger.py", line 78, in pt_init
    history=self.debugger_history,
AttributeError: 'RichPdb' object has no attribute 'debugger_history'

I fixed it by simply adding

                self.debugger_history = FileHistory(self._ipython_history_file)

before or after self.debugger_history = FileHistory(self._ipython_history_file) in pdbr/_pdbr.py::pt_init.

In Ipython, the code that uses those attributes is awkward and there seems not to be a workaround; If we only put one of the 2 lines, we cannot get the right file.

But maybe there is a reason why you want to stick with 7.X?

Thanks!

Hi @philipGaudreau, yes i was planning and i tried the latest version on my local and saw this error. Then created an PR in order to fix the problem in ipython side. But your solution is working both 7.x and 8.x if it is placed under if self._ipython_history_file: line in pt_init.

Actually I don't want to be involved in the user's version selection. I added extra install to just show ipython support of pdbr. It would be great if pdbr could work with all versions. Feel free to create a PR regarding this.

Thanks.

@philipGaudreau i put the line you can test with v0.6.9