New submission from Xavier de Gaye:

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)

----------
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 <rep...@bugs.python.org>
<http://bugs.python.org/issue22502>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to