Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior in pdb when pressing Ctrl-C #64468

Open
xdegaye mannequin opened this issue Jan 15, 2014 · 2 comments
Open

Inconsistent behavior in pdb when pressing Ctrl-C #64468

xdegaye mannequin opened this issue Jan 15, 2014 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Jan 15, 2014

BPO 20269
Nosy @birkenfeld, @xdegaye, @sdownum
Files
  • sigint.patch
  • sigint_2.patch
  • 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 2014-01-15.09:28:52.923>
    labels = ['type-bug', 'library']
    title = 'Inconsistent behavior in pdb when pressing Ctrl-C'
    updated_at = <Date 2014-05-24.13:33:50.346>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2014-05-24.13:33:50.346>
    actor = 'xdegaye'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2014-01-15.09:28:52.923>
    creator = 'xdegaye'
    dependencies = []
    files = ['33478', '35339']
    hgrepos = []
    issue_num = 20269
    keywords = ['patch']
    message_count = 2.0
    messages = ['208151', '219040']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'xdegaye', 'steven.downum']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue20269'
    versions = ['Python 3.5']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 15, 2014

    With this script:
    # START
    def foo():
    while 1:
    pass

    import pdb; pdb.set_trace()
    foo()
    # END

    The following sequence of pdb commands aborts the script with a KeyboardInterrupt exception:
    next
    Ctrl-C
    continue

    While the equivalent following sequence of commands allows the debugging session to continue as
    expected:
    continue
    Ctrl-C
    continue

    The first sequence of commands should behave as the second one.

    A related problem is that the original SIGINT handler (named _previous_sigint_handler in the code)
    is not restored when the program being debugged is stopped at a breakpoint that has been reached
    after 'continue'. _previous_sigint_handler is lost forever in this case when the user hits
    'continue' after stopping at that breakpoint, which is quite common. This is annoying. For example,
    trying to extend pdb with a 'detach' command that enables the debuggee to run freely after the
    debugging session is terminated: the program cannot be killed anymore with SIGINT when the above
    case occurs.

    The attached patch attempts to fix these problems.
    After applying the attached patch, the behavior of the 'next, Ctrl-C, continue' sequence of commands
    is still wrong: this is another bug logged at bpo-14788 with a patch and a test. Applying patch
    14788 fixes this.

    @xdegaye xdegaye mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jan 15, 2014
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 24, 2014

    The patch with a test case.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants