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

<Ctl-C> after continue in pdb stops in signal.py #66692

Closed
xdegaye mannequin opened this issue Sep 27, 2014 · 2 comments
Closed

<Ctl-C> after continue in pdb stops in signal.py #66692

xdegaye mannequin opened this issue Sep 27, 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 Sep 27, 2014

BPO 22502
Nosy @birkenfeld, @xdegaye

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 = <Date 2016-10-12.18:26:51.994>
created_at = <Date 2014-09-27.08:40:39.640>
labels = ['type-bug', 'library']
title = '<Ctl-C> after continue in pdb stops in signal.py'
updated_at = <Date 2016-10-12.18:26:51.992>
user = 'https://github.com/xdegaye'

bugs.python.org fields:

activity = <Date 2016-10-12.18:26:51.992>
actor = 'xdegaye'
assignee = 'none'
closed = True
closed_date = <Date 2016-10-12.18:26:51.994>
closer = 'xdegaye'
components = ['Library (Lib)']
creation = <Date 2014-09-27.08:40:39.640>
creator = 'xdegaye'
dependencies = []
files = []
hgrepos = []
issue_num = 22502
keywords = []
message_count = 2.0
messages = ['227666', '278535']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'xdegaye']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue22502'
versions = ['Python 3.5']

@xdegaye
Copy link
Mannequin Author

xdegaye mannequin commented Sep 27, 2014

With the following script:

import time

def foo():
    import pdb; pdb.set_trace()
    while 1:
        time.sleep(.5)

foo()

Hitting ^C after continue gives:

$ ./python foo.py
> foo.py(5)foo()
-> while 1:
(Pdb) continue
^C
Program interrupted. (Use 'cont' to resume).
--Call--
> Lib/signal.py(51)signal()
-> @_wraps(_signal.signal)
(Pdb)

This is fixed with the following change:

diff --git a/Lib/pdb.py b/Lib/pdb.py
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -186,9 +186,9 @@
             raise KeyboardInterrupt
         self.message("\nProgram interrupted. (Use 'cont' to resume).")
         self.set_step()
-        self.set_trace(frame)
         # restore previous signal handler
         signal.signal(signal.SIGINT, self._previous_sigint_handler)
+        self.set_trace(frame)
     def reset(self):
         bdb.Bdb.reset(self)

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

xdegaye mannequin commented Oct 12, 2016

Fixed in bpo-20766.

@xdegaye xdegaye mannequin closed this as completed Oct 12, 2016
@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