Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jupyter/jupyter_client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.4.1
Choose a base ref
...
head repository: jupyter/jupyter_client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0a45cc41e4ce73911e4367eddc1f0001a8431fc0
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Oct 11, 2022

  1. Copy the full SHA
    0a45cc4 View commit details
Showing with 14 additions and 7 deletions.
  1. +1 −1 .github/workflows/main.yml
  2. +8 −5 jupyter_client/manager.py
  3. +5 −1 jupyter_client/session.py
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -130,7 +130,7 @@ jobs:
pip check
- name: Run the tests
run: |
pytest -vv jupyter_client || pytest -vv jupyter_client --lf
pytest -vv -W default jupyter_client || pytest -vv -W default jupyter_client --lf
make_sdist:
name: Make SDist
13 changes: 8 additions & 5 deletions jupyter_client/manager.py
Original file line number Diff line number Diff line change
@@ -65,11 +65,12 @@ def in_pending_state(method: F) -> F:
@functools.wraps(method)
async def wrapper(self, *args, **kwargs):
# Create a future for the decorated method
try:
self._ready = Future()
except RuntimeError:
# No event loop running, use concurrent future
self._ready = CFuture()
if self._attempted_start:
try:
self._ready = Future()
except RuntimeError:
# No event loop running, use concurrent future
self._ready = CFuture()
try:
# call wrapped method, await, and set the result or exception.
out = await method(self, *args, **kwargs)
@@ -96,6 +97,7 @@ class KernelManager(ConnectionFileMixin):
def __init__(self, *args, **kwargs):
super().__init__(**kwargs)
self._shutdown_status = _ShutdownStatus.Unset
self._attempted_start = False
# Create a place holder future.
try:
asyncio.get_running_loop()
@@ -382,6 +384,7 @@ async def _async_start_kernel(self, **kw: t.Any) -> None:
keyword arguments that are passed down to build the kernel_cmd
and launching the kernel (e.g. Popen kwargs).
"""
self._attempted_start = True
kernel_cmd, kw = await ensure_async(self.pre_start_kernel(**kw))

# launch the kernel subprocess
6 changes: 5 additions & 1 deletion jupyter_client/session.py
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
from typing import Optional
from typing import Union

import zmq
import zmq.asyncio
from traitlets import Any
from traitlets import Bool
from traitlets import CBytes
@@ -807,6 +807,10 @@ def send(
# ZMQStreams and dummy sockets do not support tracking.
track = False

if isinstance(stream, zmq.asyncio.Socket):
assert stream is not None
stream = zmq.Socket.shadow(stream.underlying)

if isinstance(msg_or_type, (Message, dict)):
# We got a Message or message dict, not a msg_type so don't
# build a new Message.