Skip to content

Commit 1042e52

Browse files
committed
FIxes ipyparallel
1 parent 8be7770 commit 1042e52

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ipykernel/iostream.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class IOPubThread:
4747
whose IO is always run in a thread.
4848
"""
4949

50-
def __init__(self, socket, session, pipe=False):
50+
def __init__(self, socket, session=None, pipe=False):
5151
"""Create IOPub thread
5252
5353
Parameters
@@ -120,6 +120,15 @@ def _send_welcome_message(self, subscription):
120120
The subscription topic (UTF-8 decoded)
121121
"""
122122

123+
# TODO: This early return is for backward-compatibility with ipyparallel.
124+
# This should be removed when ipykernel has been released with support of
125+
# xpub and ipyparallel has been updated to pass the session parameter
126+
# to IOPubThread upon construction.
127+
# (NB: the call to fix is here:
128+
# https://github.com/ipython/ipyparallel/blob/main/ipyparallel/engine/app.py#L679
129+
if self.session is None:
130+
return
131+
123132
content = {"subscription": subscription}
124133

125134
header = self.session.msg_header("iopub_welcome")

0 commit comments

Comments
 (0)