[Python-Dev] test_doctest failing

Titus Brown titus at caltech.edu
Sat Nov 24 07:44:01 CET 2007


On Fri, Nov 23, 2007 at 10:32:25PM -0600, skip at pobox.com wrote:
-> 
->     Brett> Looks like Skip's r59137 fix for working with tracing has led to
->     Brett> test_doctest to be broken on 2.5 and the trunk (at least
->     Brett> according to the buildbots).  Can someone either revert the
->     Brett> commit or fix it?  I would normally do it myself but US
->     Brett> Thanksgiving has me tied up to not do too much beyond bitching
->     Brett> about the amount of buildbot emails I have been getting.  =)
-> 
-> Sorry.  I did verify that it solved the problem I was having with trace &
-> doctest, but I completely forgot to make test after applying that patch.
-> The checkins have been reverted.

Skip, this set_trace rewrite fixes the problem in both 25-maint and
trunk:

    def set_trace(self, frame=None):
        self.__debugger_used = True
        if frame is None:
            frame = sys._getframe().f_back
        pdb.Pdb.set_trace(self, frame)

from the old:

    def set_trace(self):
        self.__debugger_used = True
        pdb.Pdb.set_trace(self)

This was an actual bug: the patch didn't correctly allow for the fact
that Bdb.set_trace(self, None) went and got the calling frame -- which,
when the function was overriden in a subclass, was the subclass
function.

Let me know if you want a formal patch or somethin'.  And thanks for
tackling the doctest/trace situation - some users have been complaining
about it to me and it was on my list for tomorrow!

Happy post-Thanksgiving, all!

cheers,
--titus


More information about the Python-Dev mailing list