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

only flush stream in dispatch_shell if possible #405

Merged
merged 5 commits into from
Jun 17, 2019
Merged

only flush stream in dispatch_shell if possible #405

merged 5 commits into from
Jun 17, 2019

Conversation

Chilipp
Copy link
Contributor

@Chilipp Chilipp commented May 26, 2019

When using an inprocess kernel, the kernel client calls the dispatch_shell method with an ipykernel.inprocess.socker.DummySocket

kernel.dispatch_shell(stream, msg_parts)

This method, however, expects the given stream to have a flush method

stream.flush(zmq.POLLOUT)

which is not True, for the DummySocket. This PR proposes to accept failures for the latter by replacing this line with

try:
    stream.flush(zmq.POLLOUT)
except AttributeError:
    pass

@minrk
Copy link
Member

minrk commented Jun 13, 2019

Thanks for the PR! I think it's a valid assumption that the stream provide the stream API. Maybe the better fix is to add a no-op flush method to DummySocket so that it complies with the stream API?

@Chilipp
Copy link
Contributor Author

Chilipp commented Jun 13, 2019

You're right @minrk, I fully agree. It revert the previous implementation (14a2c7a) and added a dummy flush method (c9ec713)

Co-Authored-By: Min RK <benjaminrk@gmail.com>
@minrk minrk merged commit 604ee89 into ipython:master Jun 17, 2019
@minrk
Copy link
Member

minrk commented Jun 17, 2019

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants