code: def set_trace(self, frame=None):
          
          if hasattr(local, '_pdbpp_completing'):
              # Handle set_trace being called during completion, e.g. with
              # fancycompleter's attr_matches.
              return
          if frame is None:
              frame = sys._getframe().f_back
          self._via_set_trace_frame = frame
          return super(Pdb, self).set_trace(frame)
docs: Remember starting frame.
  
          This is used with pytest, which does not use pdb.set_trace().