[New-bugs-announce] [issue22502] <Ctl-C> after continue in pdb stops in signal.py

Xavier de Gaye report at bugs.python.org
Sat Sep 27 10:40:39 CEST 2014

New submission from Xavier de Gaye:

With the following script:

import time

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


Hitting ^C after continue gives:

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

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_trace(frame)
         # restore previous signal handler
         signal.signal(signal.SIGINT, self._previous_sigint_handler)
+        self.set_trace(frame)

     def reset(self):

components: Library (Lib)
messages: 227666
nosy: georg.brandl, xdegaye
priority: normal
severity: normal
status: open
title: <Ctl-C> after continue in pdb stops in signal.py
type: behavior
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list