File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 66# Copyright (c) IPython Development Team.
77# Distributed under the terms of the Modified BSD License.
88import asyncio
9+ import inspect
910import json
1011import os
1112import signal
1718
1819import ipykernel
1920import zmq
21+ from ipykernel .iostream import IOPubThread
2022from ipykernel .kernelapp import IPKernelApp
2123from ipykernel .zmqshell import ZMQInteractiveShell
2224from IPython .core .profiledir import ProfileDir
@@ -667,17 +669,18 @@ def urls(key):
667669
668670 # create iopub stream:
669671 iopub_addr = url ('iopub' )
670- iopub_socket = self .iopub_socket = ctx .socket (zmq .PUB )
672+ thread_params = {}
673+ if 'session' in inspect .signature (IOPubThread ).parameters :
674+ iopub_socket_type = zmq .XPUB
675+ thread_params ["session" ] = self .session
676+ else :
677+ iopub_socket_type = zmq .PUB
678+ iopub_socket = self .iopub_socket = ctx .socket (iopub_socket_type )
671679 iopub_socket .SNDHWM = 0
672680 iopub_socket .setsockopt (zmq .IDENTITY , identity )
673681 connect (iopub_socket , iopub_addr )
674- try :
675- from ipykernel .iostream import IOPubThread
676- except ImportError :
677- pass
678- else :
679- iopub_socket = IOPubThread (iopub_socket )
680- iopub_socket .start ()
682+ iopub_socket = IOPubThread (iopub_socket , ** thread_params )
683+ iopub_socket .start ()
681684
682685 # disable history:
683686 self .config .HistoryManager .hist_file = ':memory:'
You can’t perform that action at this time.
0 commit comments