This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients georg.brandl, meador.inge, orsenthil, tshepang, xdegaye
Date 2012-04-30.20:00:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1335816055.5.0.095507708769.issue13183@psf.upfronthosting.co.za>
In-reply-to
Content
Hi Senthil,

Thanks for your help with this issue.

self.frame_returning is both a flag to indicate that we are returning
from the current frame and a value (the current frame). We need both
as set_step() (the method invoked when the user runs the step command)
does not know the current frame and wether we are returning from the
current frame.

Here is a raw sketch of the call chain in the case where the user
types the step command on returning from the current frame (Pdb
subclasses both bdb.Bdb and cmd.Cmd):

Bdb::dispatch_return
    Pdb::user_return (Bdb overriden method)
        Pdb::interaction
            Cmd::cmdloop
                Cmd::onecmd
                    Pdb::do_step
                        Bdb::set_step

So self.frame_returning must be set to None after the call to
self.user_return() so that its value is not used in another later step
command, where we are not returning from this frame. Actually it is
more explicit and more robust to use a try-finally clause, such as:

    def dispatch_return(self, frame, arg):
        if self.stop_here(frame) or frame == self.returnframe:
            try:
                self.frame_returning = frame
                self.user_return(frame, arg)
            finally:
                self.frame_returning = None
            if self.quitting: raise BdbQuit
        return self.trace_dispatch


Xavier
History
Date User Action Args
2012-04-30 20:00:55xdegayesetrecipients: + xdegaye, georg.brandl, orsenthil, meador.inge, tshepang
2012-04-30 20:00:55xdegayesetmessageid: <1335816055.5.0.095507708769.issue13183@psf.upfronthosting.co.za>
2012-04-30 20:00:54xdegayelinkissue13183 messages
2012-04-30 20:00:54xdegayecreate