Xavier de Gaye <xdeg...@gmail.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13183>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to