mirror of https://github.com/mahmoud/boltons.git
fix pdb_on_signal, add a helpful comment
This commit is contained in:
parent
d0ffe8b407
commit
c57da7457b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue