From 2b7a18153d85d888e732a3f662b96fb8b83b097b 2006-11-23 19:25:10 From: vivainio Date: 2006-11-23 19:25:10 Subject: [PATCH] R. Bernstein's patch for passing correct Pdb object to %pydb --- diff --git a/IPython/Extensions/ipy_pydb.py b/IPython/Extensions/ipy_pydb.py index 7da5c59..f23aa65 100755 --- a/IPython/Extensions/ipy_pydb.py +++ b/IPython/Extensions/ipy_pydb.py @@ -1,15 +1,31 @@ -import pydb +import inspect import IPython.ipapi from IPython.genutils import arg_split ip = IPython.ipapi.get() +from IPython import Debugger + def call_pydb(self, args): + """Invoke pydb with the supplied parameters.""" + try: + import pydb + except ImportError: + raise ImportError("pydb doesn't seem to be installed.") + + if not hasattr(pydb.pydb, "runv"): + raise ImportError("You need pydb version 1.19 or later installed.") + argl = arg_split(args) # print argl # dbg - ip.IP.history_saving_wrapper( lambda : pydb.runl(*argl) )() + if len(inspect.getargspec(pydb.runv)[0]) == 2: + pdb = Debugger.Pdb() + ip.IP.history_saving_wrapper( lambda : pydb.runv(argl, pdb) )() + else: + ip.IP.history_saving_wrapper( lambda : pydb.runv(argl) )() + ip.expose_magic("pydb",call_pydb) - \ No newline at end of file +