You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that the user should be able to type quit() in order to exit the interactive Python shell and go back to the PDB shell, similar to a regular interactive Python session. I think you should also support exit() because the Python shell supports that one as well (quit() and exit() do the same thing, I think the alias exists to help discoverability for new users).
Both "exit" and "quit" and even just "q" quit the PDB interactive shell.
KerrickStaley commented on Jun 24, 2020
KerrickStaleymannequin
MannequinAuthor
More actions
Serhiy: I'm referring to the interactive mode that can be entered by typing "interact" in PDB.
Here are reproduction instructions:
Run "python3" command.
In Python shell, type "import pdb; pdb.set_trace()".
In PDB shell, type "interact".
Now, in this "PDB InteractiveConsole" shell (I'm not sure what it's called), the only way to go back to PDB is to press Ctrl+D. If you type "quit()" or "exit()" it exits the entire Python process. If you type "q" it says "NameError: name 'q' is not defined".
In Jupyter, I get different (but still undesirable) behavior: "quit()" raises "NameError: name 'quit' is not defined" (and similar for "exit()").
I think "quit()"/"exit()" in these contexts should return you back to the PDB shell.
Activity
KerrickStaley commentedon Jun 24, 2020
In PDB, when you use "interact" to enter an interactive shell, the only way to exit that shell is to send an end-of-transmission (Ctrl+D) character. In some environments, such as Jupyter, this is awkward to do. Here is a StackOverflow post where a user encountered this issue:
https://stackoverflow.com/questions/47522316/exit-pdb-interactive-mode-from-jupyter-notebook/62546186
I think that the user should be able to type quit() in order to exit the interactive Python shell and go back to the PDB shell, similar to a regular interactive Python session. I think you should also support exit() because the Python shell supports that one as well (quit() and exit() do the same thing, I think the alias exists to help discoverability for new users).
I confirmed this issue on Python 3.6.9 and 3.8.3.
serhiy-storchaka commentedon Jun 24, 2020
Both "exit" and "quit" and even just "q" quit the PDB interactive shell.
KerrickStaley commentedon Jun 24, 2020
Serhiy: I'm referring to the interactive mode that can be entered by typing "interact" in PDB.
Here are reproduction instructions:
Now, in this "PDB InteractiveConsole" shell (I'm not sure what it's called), the only way to go back to PDB is to press Ctrl+D. If you type "quit()" or "exit()" it exits the entire Python process. If you type "q" it says "NameError: name 'q' is not defined".
In Jupyter, I get different (but still undesirable) behavior: "quit()" raises "NameError: name 'quit' is not defined" (and similar for "exit()").
I think "quit()"/"exit()" in these contexts should return you back to the PDB shell.
serhiy-storchaka commentedon Jun 24, 2020
Thank you, now I understand the problem.
It is reasonable request, but a new feature can only be added in Python 3.10.
gaogaotiantian commentedon Oct 18, 2023
exit()andquit()exits the interactive context and return to PDB console now with #102896 .