jupyter-kill-kernel: Don't unbind the session slot of a kernel

Not really sure why this was done in the first place, but a kernel can be
forcibly killed and then asked to started up again, e.g. when restarting the
kernel.
This commit is contained in:
Nathaniel Nicandro 2019-06-12 21:59:50 -05:00
parent b96a9c5b6a
commit 23ad05fd64
2 changed files with 4 additions and 9 deletions

View file

@ -104,9 +104,8 @@ implementation of `jupyter-kill-kernel'.
A convenience method, `jupyter-kernel-name', is provided to
access the name of the kernelspec.")
(cl-defmethod jupyter-kill-kernel ((kernel jupyter-meta-kernel))
(when (slot-boundp kernel 'session)
(slot-makeunbound kernel 'session)))
(cl-defmethod jupyter-kill-kernel ((_kernel jupyter-meta-kernel))
(ignore))
(cl-defmethod jupyter-kernel-name ((kernel jupyter-meta-kernel))
"Return the name of KERNEL."

View file

@ -623,8 +623,6 @@
(should-error (jupyter-start-kernel kernel))
(jupyter-kill-kernel kernel)
(should-not (jupyter-kernel-alive-p kernel))
;; A session should not be re-used across kernels
(should-not (slot-boundp kernel 'session))
(setq conn-info (jupyter-create-connection-info))
(ert-info ("`jupyter-kernel-manager'")
;; TODO: Should the manager create a session if one isn't present?
@ -659,11 +657,9 @@
(should-not (jupyter-kernel-alive-p kernel))
(jupyter-start-kernel kernel)
(should (jupyter-kernel-alive-p kernel))
(should (oref kernel session)))
(ert-info ("Session is invalid when kernel is no longer alive")
(should (oref kernel session))
(jupyter-kill-kernel kernel)
(should-not (jupyter-kernel-alive-p kernel))
(should-not (slot-boundp kernel 'session)))
(should-not (jupyter-kernel-alive-p kernel)))
(ert-info ("Can we communicate?")
(let ((manager (jupyter-kernel-manager :kernel kernel)))
(jupyter-start-kernel manager)