diff --git a/boltons/debugutils.py b/boltons/debugutils.py new file mode 100644 index 0000000..5ac4f0f --- /dev/null +++ b/boltons/debugutils.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + + +def pdb_on_signal(signal=None): + import pdb + import signal + if not signal: + signal = signal.SIGINT + + def pdb_int_handler(sig, frame): + pdb.set_trace() + + signal.signal(signal.SIGINT, pdb_int_handler) + return