@monkeypatch_method(pdb.Pdb, 'Pdb')
def user_return(self, frame, return_value):
 if self._wait_for_mainpyfile:
  if ((self.mainpyfile != self.canonic(frame.f_code.co_filename)) or (frame.f_lineno <= 0)):
   return
  self._wait_for_mainpyfile = 0
 self._old_Pdb_user_return(frame, return_value)

@ monkeypatch_method ( pdb . Pdb , 'Pdb' ) def user_return ( self , frame , return_value ) : if self . _wait_for_mainpyfile : if ( ( self . mainpyfile != self . canonic ( frame . f_code . co_filename ) ) or ( frame . f_lineno <= 0 ) ) : return self . _wait_for_mainpyfile = 0 self . _old_Pdb_user_return ( frame , return_value )
this function is called when a return trap is set here .