Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that channels exist before asking if they are alive #785

Merged
merged 1 commit into from
May 8, 2022

Conversation

ccordoba12
Copy link
Contributor

This extra check fixes issue spyder-ide/spyder#17776 in Spyder, which appeared with Jupyter-client 7.3.0.

It only happens when Spyder is closed, but I don't understand very well why. Since it's a small patch, I hope it'll be accepted so that we don't have to subclass QtKernelClient on our side for this.

Copy link
Member

@davidbrochart davidbrochart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ccordoba12, although I'm not sure how this method is used in the wild, I think that your changes are correct.

Comment on lines +340 to +344
(self._shell_channel and self.shell_channel.is_alive())
or (self._iopub_channel and self.iopub_channel.is_alive())
or (self._stdin_channel and self.stdin_channel.is_alive())
or (self._hb_channel and self.hb_channel.is_alive())
or (self._control_channel and self.control_channel.is_alive())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem more in line with the docstring "Are any of the channels created and running?", e.g. with only self.shell_channel.is_alive() we are creating a shell channel if it doesn't already exists, so we are only checking if it is running.
Your changes ensure that a channel already exists before checking if it is running, which seems like the right thing to do IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @davidbrochart!

@davidbrochart davidbrochart merged commit 4df8a48 into jupyter:main May 8, 2022
@ccordoba12 ccordoba12 deleted the fix-channels-running-error branch May 8, 2022 21:17
@ccordoba12
Copy link
Contributor Author

Thanks a lot for your prompt reply @davidbrochart and for releasing 7.3.1 with my fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants