From 539ee5da6fb2a56869e6c6f4401300b4d5906d76 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Tue, 4 Dec 2012 21:08:28 +0200 Subject: Issue #13120: Allow to call pdb.set_trace() from thread. Patch by Ilya Sandler. --- Lib/pdb.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Lib/pdb.py') diff --git a/Lib/pdb.py b/Lib/pdb.py index 6776a3f4cf..8c7c12b92c 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -955,8 +955,15 @@ class Pdb(bdb.Bdb, cmd.Cmd): Continue execution, only stop when a breakpoint is encountered. """ if not self.nosigint: - self._previous_sigint_handler = \ - signal.signal(signal.SIGINT, self.sigint_handler) + try: + self._previous_sigint_handler = \ + signal.signal(signal.SIGINT, self.sigint_handler) + except ValueError: + # ValueError happens when do_continue() is invoked from + # a non-main thread in which case we just continue without + # SIGINT set. Would printing a message here (once) make + # sense? + pass self.set_continue() return 1 do_c = do_cont = do_continue -- cgit v1.2.1