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

Do not pass loop if Python >=3.10 #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions aredis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
InvalidResponse, AskError,
MovedError, TryAgainError,
ClusterDownError, ClusterCrossSlotError)
from aredis.utils import b, nativestr, LOOP_DEPRECATED
from aredis.utils import b, nativestr, LOOP_DEPRECATED, LOOP_DEPRECATED_OPEN_CONNECTION

try:
import hiredis
Expand Down Expand Up @@ -593,11 +593,18 @@ def __init__(self, host='127.0.0.1', port=6379, password=None,
self.socket_keepalive_options = socket_keepalive_options or {}

async def _connect(self):
reader, writer = await exec_with_timeout(
asyncio.open_connection(host=self.host,
if LOOP_DEPRECATED_OPEN_CONNECTION:
coro=asyncio.open_connection(host=self.host,
port=self.port,
ssl=self.ssl_context)
else:
coro=asyncio.open_connection(host=self.host,
port=self.port,
ssl=self.ssl_context,
loop=self.loop),
loop=self.loop)

reader, writer = await exec_with_timeout(coro
,
self._connect_timeout,
loop=self.loop
)
Expand Down
1 change: 1 addition & 0 deletions aredis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
pass

LOOP_DEPRECATED = sys.version_info >= (3, 8)
LOOP_DEPRECATED_OPEN_CONNECTION=sys.version_info >= (3, 10)


def b(x):
Expand Down