[IPython-dev] making pdoc, pdef, and pinfo more generally useful (Was Re: Patches to use pydb instead of pdb for debugging)
rocky at panix.com
Sat Oct 14 05:21:12 CDT 2006
Ville M. Vainio writes:
> I'll apply them sometime next week. In the meantime, give it some more
> testing to see whether there are more gotchas.
Sure. Will do. As explained before, part (but not all) of the problem
is that you were using something I wasn't really aware of: run -d.
What else is there to test? (See below for what I tried.)
Is there a regression test or unit test framework for ipython? That's
what I use in pydb to make sure bugs don't creep in and I've found it
What I tested was %pdb (and option -pdb) and post-mortem
debugging. And the pydb.runl() command I added. I've now tried "run
-d", although it has the weakness mentioned before. It also has a
weakness in that pydb debugger commands "run" and "restart" don't
work; to fix them up incrementally means going back into that awkward
code in Magic.magic_run(), shared by pdb. Since pdb doesn't have
"restart" or "run" commands, there's no *loss* for folks who use
ipython's "run -d". So my take is to let that one go for now, and have
folks use pydb.runl() if they want some sort of restart.
And speaking of that hacky magic_run code, it occurs to me that it is
also a bit wrong for debugging. It sets a permanent break on what it
determines is the first line of the Python script. So if the first
executable line is say a loop, you keep stopping at that line which I
don't think was the intent. Better would be a *temporary* breakpoint.
(And even better to remove altogether for pydb by understanding
problem(s) this code trying to address.)
> The previous bug was fixed by this:
> def new_do_quit(self, arg):
> - __IPYTHON__.Completer.all_completions=self.old_all_completions
> + if hasattr(self, 'all_completions'):
> + __IPYTHON__.Completer.all_completions=self.old_all_completions
> return OldPdb.do_quit(self, arg)
> (it was AttributeError - there was no old_all_completions.
Interesting for a couple of reasons. First, yes that bug is still in
the patch I sent. So I'm glad it was brought up. Second, if you found
this in testing *with* pydb installed, it means you weren't using the
current CVS sources. Again, in the last patch I've narrowed the scope
of changes so that you now *have* to use the lastest sources,
currently only in CVS if you want pydb. Again, my take is to make a
pydb release along with the ipython release.
> Also see
> whether there is a cleaner fix).
Well, since this is only needed for pydb, you could put that in the
self.do_q = self.do_quit = decorate_fn_with_doc(self.new_do_quit,
But what's there isn't so bad either.
More information about the IPython-dev