Skip to content

Commit

Permalink
Mark initial frame as not hidden.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 19, 2020
1 parent 5da9f44 commit 7b7f470
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
13 changes: 10 additions & 3 deletions IPython/core/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ def set_colors(self, scheme):
self.color_scheme_table.set_active_scheme(scheme)
self.parser.style = scheme

def set_trace(self, frame=None):
if frame is None:
frame = sys._getframe().f_back
self.initial_frame = frame
return super().set_trace(frame)

def hidden_frames(self, stack):
"""
Expand All @@ -299,9 +304,11 @@ def hidden_frames(self, stack):
# avoid calling it here to preserve self.curframe_locals.
# Futhermore, there is no good reason to hide the current frame.
ip_hide = [
False if s[0] is self.curframe else s[0].f_locals.get(
"__tracebackhide__", False)
for s in stack]
False
if s[0] in (self.curframe, getattr(self, "initial_frame", None))
else s[0].f_locals.get("__tracebackhide__", False)
for s in stack
]
ip_start = [i for i, s in enumerate(ip_hide) if s == "__ipython_bottom__"]
if ip_start:
ip_hide = [h if i > ip_start[0] else True for (i, h) in enumerate(ip_hide)]
Expand Down
5 changes: 3 additions & 2 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,9 @@ def init_profile_dir(self, profile_dir):
if profile_dir is not None:
self.profile_dir = profile_dir
return
self.profile_dir =\
ProfileDir.create_profile_dir_by_name(self.ipython_dir, 'default')
self.profile_dir = ProfileDir.create_profile_dir_by_name(
self.ipython_dir, "default"
)

def init_instance_attrs(self):
self.more = False
Expand Down

0 comments on commit 7b7f470

Please sign in to comment.