Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed filtering of stack frames for testing #633

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions ipykernel/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,21 @@ async def source(self, message):

async def stackTrace(self, message):
reply = await self._forward_message(message)
# The stackFrames array has the following content:
# The stackFrames array can have the following content:
# { frames from the notebook}
# ...
# { 'id': xxx, 'name': '<module>', ... } <= this is the first frame of the code from the notebook
# { frames from ipykernel }
# ...
# {'id': yyy, 'name': '<module>', ... } <= this is the first frame of ipykernel code
# We want to remove all the frames from ipykernel
sf_list = reply['body']['stackFrames']
module_idx = len(sf_list) - next(i for i, v in enumerate(reversed(sf_list), 1) if v['name'] == '<module>' and i != 1)
reply['body']['stackFrames'] = reply['body']['stackFrames'][:module_idx+1]
# or only the frames from the notebook.
# We want to remove all the frames from ipykernel when they are present.
try:
sf_list = reply['body']['stackFrames']
module_idx = len(sf_list) - next(i for i, v in enumerate(reversed(sf_list), 1) if v['name'] == '<module>' and i != 1)
reply['body']['stackFrames'] = reply['body']['stackFrames'][:module_idx+1]
except StopIteration:
pass
return reply

def accept_variable(self, variable_name):
Expand Down