Backport PR #12445: avoid calling .f_locals on the current frame
Matthias Bussonnier -
r25899:223edad2
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -294,7 +294,14 class Pdb(OldPdb):
294
294
295 This is used in up/down and where to skip frames.
295 This is used in up/down and where to skip frames.
296 """
296 """
297 ip_hide = [s[0].f_locals.get("__tracebackhide__", False) for s in stack]
297 # The f_locals dictionary is updated from the actual frame
298 # locals whenever the .f_locals accessor is called, so we
299 # avoid calling it here to preserve self.curframe_locals.
300 # Futhermore, there is no good reason to hide the current frame.
301 ip_hide = [
302 False if s[0] is self.curframe else s[0].f_locals.get(
303 "__tracebackhide__", False)
304 for s in stack]
298 ip_start = [i for i, s in enumerate(ip_hide) if s == "__ipython_bottom__"]
305 ip_start = [i for i, s in enumerate(ip_hide) if s == "__ipython_bottom__"]
299 if ip_start:
306 if ip_start:
300 ip_hide = [h if i > ip_start[0] else True for (i, h) in enumerate(ip_hide)]
307 ip_hide = [h if i > ip_start[0] else True for (i, h) in enumerate(ip_hide)]
Comments 0
You need to be logged in to leave comments. Login now