@@ -274,10 +274,9 @@ async def process_control_message(self, msg=None):
274
274
assert self .control_thread is None or threading .current_thread () == self .control_thread
275
275
276
276
msg = msg or await self .control_socket .recv_multipart ()
277
- copy = not isinstance (msg [0 ], zmq .Message )
278
- idents , msg = self .session .feed_identities (msg , copy = copy )
277
+ idents , msg = self .session .feed_identities (msg )
279
278
try :
280
- msg = self .session .deserialize (msg , content = True , copy = copy )
279
+ msg = self .session .deserialize (msg , content = True )
281
280
except Exception :
282
281
self .log .error ("Invalid Control Message" , exc_info = True ) # noqa: G201
283
282
return
@@ -375,15 +374,12 @@ async def shell_channel_thread_main(self):
375
374
376
375
try :
377
376
while True :
378
- msg = await self .shell_socket .recv_multipart ()
379
-
380
- # Deserialize whole message just to get subshell_id.
377
+ msg = await self .shell_socket .recv_multipart (copy = False )
378
+ # deserialize only the header to get subshell_id
381
379
# Keep original message to send to subshell_id unmodified.
382
- # Ideally only want to deserialize message once.
383
- copy = not isinstance (msg [0 ], zmq .Message )
384
- _ , msg2 = self .session .feed_identities (msg , copy = copy )
380
+ _ , msg2 = self .session .feed_identities (msg , copy = False )
385
381
try :
386
- msg3 = self .session .deserialize (msg2 , content = False , copy = copy )
382
+ msg3 = self .session .deserialize (msg2 , content = False , copy = False )
387
383
subshell_id = msg3 ["header" ].get ("subshell_id" )
388
384
389
385
# Find inproc pair socket to use to send message to correct subshell.
@@ -1210,9 +1206,7 @@ def do_clear(self):
1210
1206
1211
1207
def _topic (self , topic ):
1212
1208
"""prefixed topic for IOPub messages"""
1213
- base = "kernel.%s" % self .ident
1214
-
1215
- return (f"{ base } .{ topic } " ).encode ()
1209
+ return (f"kernel.{ self .ident } .{ topic } " ).encode ()
1216
1210
1217
1211
_aborting = Bool (False )
1218
1212
0 commit comments