Skip to content

Need command to exit PDB interactive shell #85268

Closed

Description

@KerrickStaley
BPO 41096
Nosy @serhiy-storchaka

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2020-06-24.02:04:35.446>
labels = ['type-feature', 'library', '3.10']
title = 'Need command to exit PDB interactive shell'
updated_at = <Date 2020-06-24.19:27:11.039>
user = 'https://bugs.python.org/KerrickStaley'

bugs.python.org fields:

activity = <Date 2020-06-24.19:27:11.039>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2020-06-24.02:04:35.446>
creator = 'Kerrick Staley'
dependencies = []
files = []
hgrepos = []
issue_num = 41096
keywords = []
message_count = 4.0
messages = ['372226', '372233', '372270', '372274']
nosy_count = 2.0
nosy_names = ['serhiy.storchaka', 'Kerrick Staley']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue41096'
versions = ['Python 3.10']

Activity

  1. KerrickStaley commented on Jun 24, 2020

    KerrickStaleymannequin
    MannequinAuthor

    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.

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-featureA feature request or enhancement
    on Jun 24, 2020
  3. serhiy-storchaka commented on Jun 24, 2020

    @serhiy-storchaka
    Member

    Both "exit" and "quit" and even just "q" quit the PDB interactive shell.

  4. KerrickStaley commented on Jun 24, 2020

    KerrickStaleymannequin
    MannequinAuthor

    Serhiy: I'm referring to the interactive mode that can be entered by typing "interact" in PDB.

    Here are reproduction instructions:

    1. Run "python3" command.
    2. In Python shell, type "import pdb; pdb.set_trace()".
    3. 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.

  5. serhiy-storchaka commented on Jun 24, 2020

    @serhiy-storchaka
    Member

    Thank you, now I understand the problem.

    It is reasonable request, but a new feature can only be added in Python 3.10.

  6. transferred this issue fromon Apr 10, 2022
  7. gaogaotiantian commented on Oct 18, 2023

    @gaogaotiantian
    Member

    exit() and quit() exits the interactive context and return to PDB console now with #102896 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions