From e2b6c7b7111a4bf76516b88e6e248d6945110c45 2012-11-08 18:50:45 From: Bradley M. Froehle Date: 2012-11-08 18:50:45 Subject: [PATCH] Add psource command to ipdb. --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 94d84c3..7784278 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -510,6 +510,12 @@ class Pdb(OldPdb): self.shell.find_line_magic('pinfo')("pinfo %s" % arg, namespaces=namespaces) + def do_psource(self, arg): + """Print (or run through pager) the source code for an object.""" + namespaces = [('Locals', self.curframe.f_locals), + ('Globals', self.curframe.f_globals)] + self.shell.find_line_magic('psource')(arg, namespaces=namespaces) + def checkline(self, filename, lineno): """Check whether specified line seems to be executable.