Skip to content

Commit 75dc5be

Browse files
authored
Adding reset_kc to setup_kernel
1 parent 059c505 commit 75dc5be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nbclient/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ def setup_kernel(self, **kwargs):
411411
When control returns from the yield it stops the client's zmq channels, and shuts
412412
down the kernel.
413413
"""
414+
reset_kc = kwargs.pop('reset_kc', False)
415+
414416
# Can't use run_until_complete on an asynccontextmanager function :(
415417
if self.km is None:
416418
self.start_kernel_manager()
@@ -420,7 +422,8 @@ def setup_kernel(self, **kwargs):
420422
try:
421423
yield
422424
finally:
423-
self._cleanup_kernel()
425+
if reset_kc:
426+
self._cleanup_kernel()
424427

425428
@asynccontextmanager
426429
async def async_setup_kernel(self, **kwargs):

0 commit comments

Comments
 (0)