##// END OF EJS Templates
Push caching to parent frame, and cache more frames....
Matthias Bussonnier -
Show More
@@ -922,18 +922,30 b' class Pdb(OldPdb):'
922 922
923 923 return self._cachable_skip(frame)
924 924
925 @lru_cache
925 @lru_cache(1024)
926 def _cached_one_parent_frame_debuggerskip(self, frame):
927 """
928 Cache looking up for DEBUGGERSKIP on parent frame.
929
930 This should speedup walking through deep frame when one of the highest
931 one does have a debugger skip.
932
933 This is likely to introduce fake positive though.
934 """
935 while getattr(frame, "f_back", None):
936 frame = frame.f_back
937 if self._get_frame_locals(frame).get(DEBUGGERSKIP):
938 return True
939 return None
940
941 @lru_cache(1024)
926 942 def _cachable_skip(self, frame):
927 943 # if frame is tagged, skip by default.
928 944 if DEBUGGERSKIP in frame.f_code.co_varnames:
929 945 return True
930 946
931 947 # if one of the parent frame value set to True skip as well.
932
933 cframe = frame
934 while getattr(cframe, "f_back", None):
935 cframe = cframe.f_back
936 if self._get_frame_locals(cframe).get(DEBUGGERSKIP):
948 if self._cached_one_parent_frame_debuggerskip(frame):
937 949 return True
938 950
939 951 return False
General Comments 0
You need to be logged in to leave comments. Login now