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

PYTHON-1313 Fix asyncio removals in Python 3.10 #1179

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions cassandra/io/asyncioreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ def end(self):

def __init__(self, timeout, callback, loop):
delayed = self._call_delayed_coro(timeout=timeout,
callback=callback,
loop=loop)
callback=callback)
self._handle = asyncio.run_coroutine_threadsafe(delayed, loop=loop)

@staticmethod
async def _call_delayed_coro(timeout, callback, loop):
await asyncio.sleep(timeout, loop=loop)
async def _call_delayed_coro(timeout, callback):
await asyncio.sleep(timeout)
return callback()

def __lt__(self, other):
Expand Down Expand Up @@ -90,8 +89,8 @@ def __init__(self, *args, **kwargs):
self._connect_socket()
self._socket.setblocking(0)

self._write_queue = asyncio.Queue(loop=self._loop)
self._write_queue_lock = asyncio.Lock(loop=self._loop)
self._write_queue = asyncio.Queue()
self._write_queue_lock = asyncio.Lock()

# see initialize_reactor -- loop is running in a separate thread, so we
# have to use a threadsafe call
Expand Down