diff --git a/ipykernel/inprocess/ipkernel.py b/ipykernel/inprocess/ipkernel.py index 7ed47443b..e61af4277 100644 --- a/ipykernel/inprocess/ipkernel.py +++ b/ipykernel/inprocess/ipkernel.py @@ -56,7 +56,7 @@ class InProcessKernel(IPythonKernel): @default("iopub_thread") def _default_iopub_thread(self): - thread = IOPubThread(self._underlying_iopub_socket, self.session) + thread = IOPubThread(self._underlying_iopub_socket, session=self.session) thread.start() return thread diff --git a/ipykernel/iostream.py b/ipykernel/iostream.py index a426139ed..33213d167 100644 --- a/ipykernel/iostream.py +++ b/ipykernel/iostream.py @@ -47,7 +47,7 @@ class IOPubThread: whose IO is always run in a thread. """ - def __init__(self, socket, session=None, pipe=False): + def __init__(self, socket, pipe=False, session=False): """Create IOPub thread Parameters @@ -518,7 +518,7 @@ def __init__( DeprecationWarning, stacklevel=2, ) - pub_thread = IOPubThread(pub_thread, self.session) + pub_thread = IOPubThread(pub_thread, session=self.session) pub_thread.start() self.pub_thread = pub_thread self.name = name diff --git a/ipykernel/kernelapp.py b/ipykernel/kernelapp.py index a450d6ca7..b2f614ea9 100644 --- a/ipykernel/kernelapp.py +++ b/ipykernel/kernelapp.py @@ -382,7 +382,7 @@ def init_iopub(self, context): self.iopub_port = self._bind_socket(self.iopub_socket, self.iopub_port) self.log.debug("iopub PUB Channel on port: %i", self.iopub_port) self.configure_tornado_logger() - self.iopub_thread = IOPubThread(self.iopub_socket, self.session, pipe=True) + self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True, session=self.session) self.iopub_thread.start() # backward-compat: wrap iopub socket API in background thread self.iopub_socket = self.iopub_thread.background_socket diff --git a/tests/test_io.py b/tests/test_io.py index da1000f4e..217680a4f 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -28,7 +28,7 @@ def ctx(): def iopub_thread(ctx): session = Session() with ctx.socket(zmq.PUB) as pub: - thread = IOPubThread(pub, session) + thread = IOPubThread(pub, session=session) thread.start() yield thread @@ -156,7 +156,7 @@ def subprocess_test_echo_watch(): # use PUSH socket to avoid subscription issues with zmq.Context() as ctx, ctx.socket(zmq.PUSH) as pub: pub.connect(os.environ["IOPUB_URL"]) - iopub_thread = IOPubThread(pub, session) + iopub_thread = IOPubThread(pub, session=session) iopub_thread.start() stdout_fd = sys.stdout.fileno() sys.stdout.flush()