def new_method(*args, **kwargs): import pdb try: import pudb except ImportError: pudb = pdb try: pudb.runcall(method, *args, **kwargs) except pdb.bdb.BdbQuit: sys.exit('Normal quit from debugger')
def pudebug(f, *args, **kwargs): import pudb return pudb.runcall(f, *args, **kwargs)
def f(): fail from pudb import runcall runcall(f)