Skip to content

Commit e05426d

Browse files
committed
Filtered out irrelevant variables
1 parent 55c34e4 commit e05426d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

ipykernel/debugger.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ def _handle_event(self, msg):
232232
if msg['event'] == 'stopped':
233233
self.stopped_threads.append(msg['body']['threadId'])
234234
elif msg['event'] == 'continued':
235-
self.stopped_threads.remove(msg['body']['threadId'])
235+
try:
236+
self.stopped_threads.remove(msg['body']['threadId'])
237+
except:
238+
pass
236239
self.event_callback(msg)
237240

238241
async def _forward_message(self, msg):
@@ -324,7 +327,10 @@ async def stackTrace(self, message):
324327
return reply
325328

326329
def accept_variable(self, variable):
327-
return variable['type'] != 'list' and variable['type'] != 'ZMQExitAutocall' and variable['type'] != 'dict'
330+
cond = variable['type'] != 'list' and variable['type'] != 'ZMQExitAutocall' and variable['type'] != 'dict'
331+
cond = cond and variable['name'] not in ['debugpy', 'get_ipython', '_']
332+
cond = cond and variable['name'][0:2] != '_i'
333+
return cond
328334

329335
async def variables(self, message):
330336
reply = await self._forward_message(message)

ipykernel/ipkernel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def set_parent(self, ident, parent, channel='shell'):
153153
about the parent message.
154154
"""
155155
super(IPythonKernel, self).set_parent(ident, parent, channel)
156-
self.shell.set_parent(parent)
156+
if channel == 'shell':
157+
self.shell.set_parent(parent)
157158

158159
def init_metadata(self, parent):
159160
"""Initialize metadata.

0 commit comments

Comments
 (0)