classification
Title: after continue in pdb stops in signal.py
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, xdegaye
Priority: normal Keywords:

Created on 2014-09-27 08:40 by xdegaye, last changed 2016-10-12 18:26 by xdegaye. This issue is now closed.

Messages (2)
msg227666 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2014-09-27 08:40
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)
msg278535 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-10-12 18:26
Fixed in issue 20766.
History
Date User Action Args
2016-10-12 18:26:51xdegayesetstatus: open -> closed
resolution: out of date
messages: + msg278535

stage: resolved
2014-09-27 08:40:39xdegayecreate