Skip to content

Commit f924f8a

Browse files
committed
Fix control channel
1 parent a64cf72 commit f924f8a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ipykernel/kernelbase.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,15 @@ def _flush():
317317
control_loop.add_callback(_flush)
318318
return awaitable_future
319319

320-
async def process_control(self, idents, msg):
320+
async def process_control(self, msg):
321321
"""dispatch control requests"""
322+
idents, msg = self.session.feed_identities(msg, copy=False)
323+
try:
324+
msg = self.session.deserialize(msg, content=True, copy=False)
325+
except Exception:
326+
self.log.error("Invalid Control Message", exc_info=True)
327+
return
328+
322329
self.log.debug("Control received: %s", msg)
323330

324331
# Set the parent message for side effects.
@@ -476,13 +483,12 @@ def schedule_dispatch(self, dispatch, msg):
476483
try:
477484
msg = self.session.deserialize(msg, content=True, copy=False)
478485
except Exception:
479-
self.log.error("Invalid Message", exc_info=True)
486+
self.log.error("Invalid Shell Message", exc_info=True)
480487
return
481488

482489
shell_id = msg.get("metadata", {}).get("shell_id", "main")
483490

484491
if shell_id == "main":
485-
msg_queue = self.msg_queue.sync_q
486492
self.msg_queue.sync_q.put(
487493
(
488494
idx,

ipykernel/tests/test_subshell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def test_subshell():
1010
shell_id = "foo"
1111
content = dict(shell_id=shell_id)
1212
msg = kc.session.msg("subshell_request", content)
13-
kc.shell_channel.send(msg)
14-
msg = kc.get_shell_msg()
13+
kc.control_channel.send(msg)
14+
msg = kc.get_control_msg()
1515
assert msg["content"]["shell_id"] == shell_id
1616

1717
def get_content(t):

0 commit comments

Comments
 (0)