python / cpython

The Python programming language
https://www.python.org
Other
63.49k stars 30.41k forks source link

opening a repl from inside pdb via `interact` opens the basic repl #122090

Open saucoide opened 3 months ago

saucoide commented 3 months ago

Bug report

Bug description:

When using interact on a running pdb session - the basic repl is brought up instead of the new one, while launching with python -i drops you in the repl, so depending on how you like to do your debugging you end up switching between repls

➜ ./python foo.py
> /home/saucoide/projects/europython/cpython/foo.py(3)bar()
-> breakpoint()
(Pdb) interact
*pdb interact start*
>>> exit
Use exit or Ctrl-D (i.e. EOF) to exit            <-------- :(

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

saucoide commented 3 months ago

swapping which console gets run in pdb._PdbInteractiveConsole launches the the new console and seems to work (it does break a test but i didnt look at it in detail) but I dont know if it's ok to make pdb.py import things from _pyrpl just yet?

gaogaotiantian commented 3 months ago

pdb itself is using the "old" repl now. We will need to adopt the new repl for pdb first, before the interact command. I asked this when the new repl came out and the answer back then was that the repl was not ready to be used as a module - I kind of agree. The new repl is still experiencing many issues, and the code structure is probably not in the best shape to be simply imported. Once the new repl is ready and stable, I will try to make pdb use it, then we can talk about the interact command.

saucoide commented 3 months ago

thanks, makes sense :)