diff --git a/boltons/debugutils.py b/boltons/debugutils.py index 5ac4f0f..27d9d80 100644 --- a/boltons/debugutils.py +++ b/boltons/debugutils.py @@ -1,14 +1,18 @@ # -*- coding: utf-8 -*- -def pdb_on_signal(signal=None): +def pdb_on_signal(signalnum=None): import pdb import signal - if not signal: - signal = signal.SIGINT + if not signalnum: + signalnum = signal.SIGINT + + old_handler = signal.getsignal(signalnum) def pdb_int_handler(sig, frame): + signal.signal(signalnum, old_handler) pdb.set_trace() + pdb_on_signal(signalnum) # use 'u' to find your code and 'h' for help - signal.signal(signal.SIGINT, pdb_int_handler) + signal.signal(signalnum, pdb_int_handler) return