Skip to content

Commit

Permalink
Close IOPubThread._event_puller.socket
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Apr 7, 2022
1 parent 7127d06 commit b07bbd2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- name: Install the Python dependencies
run: |
pip install .[test] codecov
pip install https://github.com/davidbrochart/jupyter_client/archive/async_stream.zip
- name: Install matplotlib
if: ${{ !startsWith(matrix.os, 'macos') && !startsWith(matrix.python-version, 'pypy') }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ jobs:
git clone https://github.com/jupyter/jupyter_kernel_test.git
cd jupyter_kernel_test
pip install -e ".[test]"
pip install https://github.com/davidbrochart/jupyter_client/archive/async_stream.zip
python test_ipykernel.py
1 change: 1 addition & 0 deletions ipykernel/iostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def stop(self):
# so after thread.join, this should be safe
for event_pipe in self._event_pipes:
event_pipe.close()
self._event_puller.socket.close()

def close(self):
if self.closed:
Expand Down
3 changes: 2 additions & 1 deletion ipykernel/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pytest
import zmq
import zmq.asyncio
from jupyter_client.session import Session

from ipykernel.iostream import IOPubThread, OutStream
Expand All @@ -12,7 +13,7 @@
def test_io_api():
"""Test that wrapped stdout has the same API as a normal TextIO object"""
session = Session()
ctx = zmq.Context()
ctx = zmq.asyncio.Context()
pub = ctx.socket(zmq.PUB)
thread = IOPubThread(pub)
thread.start()
Expand Down
2 changes: 1 addition & 1 deletion ipykernel/zmqstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ async def recv_task(self, callback, copy):
def send_multipart(self, msg_list, flags=0, copy=True, track=False, **kwargs):
return self.socket.send_multipart(msg_list, copy=copy)

def flush(self, flag=None, limit = None):
def flush(self, flag=None, limit=None):
pass

0 comments on commit b07bbd2

Please sign in to comment.