Skip to content

Commit 68cc288

Browse files
committed
Changed zmqContext to not reuse instances
1 parent 08b13c1 commit 68cc288

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

jupyter_client/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class KernelManager(ConnectionFileMixin):
3939
# The PyZMQ Context to use for communication with the kernel.
4040
context = Instance(zmq.Context)
4141
def _context_default(self):
42-
return zmq.Context.instance()
42+
return zmq.Context()
4343

4444
# the class to create with our `client` method
4545
client_class = DottedObjectName('jupyter_client.blocking.BlockingKernelClient')

jupyter_client/multikernelmanager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MultiKernelManager(LoggingConfigurable):
4747
)
4848

4949
kernel_spec_manager = Instance(KernelSpecManager, allow_none=True)
50-
50+
5151
kernel_manager_class = DottedObjectName(
5252
"jupyter_client.ioloop.IOLoopKernelManager", config=True,
5353
help="""The kernel manager class. This is configurable to allow
@@ -63,7 +63,7 @@ def _kernel_manager_factory_default(self):
6363

6464
context = Instance('zmq.Context')
6565
def _context_default(self):
66-
return zmq.Context.instance()
66+
return zmq.Context()
6767

6868
connection_dir = Unicode('')
6969

jupyter_client/session.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def _logname_changed(self, name, old, new):
186186
# not configurable:
187187
context = Instance('zmq.Context')
188188
def _context_default(self):
189-
return zmq.Context.instance()
189+
return zmq.Context()
190190

191191
session = Instance('jupyter_client.session.Session',
192192
allow_none=True)
@@ -300,10 +300,10 @@ class Session(Configurable):
300300
"""
301301

302302
debug = Bool(False, config=True, help="""Debug output in the Session""")
303-
303+
304304
check_pid = Bool(True, config=True,
305305
help="""Whether to check PID to protect against calls after fork.
306-
306+
307307
This check can be disabled if fork-safety is handled elsewhere.
308308
""")
309309

@@ -387,9 +387,9 @@ def _signature_scheme_changed(self, name, old, new):
387387
digest_mod = Any()
388388
def _digest_mod_default(self):
389389
return hashlib.sha256
390-
390+
391391
auth = Instance(hmac.HMAC, allow_none=True)
392-
392+
393393
def _new_auth(self):
394394
if self.key:
395395
self.auth = hmac.HMAC(self.key, digestmod=self.digest_mod)

jupyter_client/tests/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_default_secure(self):
8383
self.assertIsInstance(self.session.auth, hmac.HMAC)
8484

8585
def test_send(self):
86-
ctx = zmq.Context.instance()
86+
ctx = zmq.Context()
8787
A = ctx.socket(zmq.PAIR)
8888
B = ctx.socket(zmq.PAIR)
8989
A.bind("inproc://test")
@@ -316,7 +316,7 @@ def test_datetimes_msgpack(self):
316316
self._datetime_test(session)
317317

318318
def test_send_raw(self):
319-
ctx = zmq.Context.instance()
319+
ctx = zmq.Context()
320320
A = ctx.socket(zmq.PAIR)
321321
B = ctx.socket(zmq.PAIR)
322322
A.bind("inproc://test")

0 commit comments

Comments
 (0)