I use a Jupyter laptop (IPython), where pdb / ipdb works fine, except for one problem: if I accidentally run the same cell that pdb is in while in pdb mode, the output disappears, the whole laptop gets stuck, and I no longer I can run commands. I also tried to interrupt or restart the kernel; does not work. My only option is to turn off the laptop and restart it.
Does anyone else experience this problem / know a solution? It is very annoying that I have to restart the notebook every time I make this mistake.
Here are screenshots of the problem. Below I am in pdb mode as expected:

If I (accidentally) launch the same cell where pdb is located, the laptop gets stuck trying to start this cell and will not start anything else (for example, the cell below).

source share