Skip to content

Commit

Permalink
Fix python 3.8 warnings #622 (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
seedofjoy authored Dec 3, 2020
1 parent 832d44c commit 1ccd947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions aiopg/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(
self._cancellation_waiter = None
self._echo = echo
self._cursor_instance = None
self._notifies = asyncio.Queue(loop=self._loop)
self._notifies = asyncio.Queue()
self._weakref = weakref.ref(self)
self._loop.add_reader(self._fileno, self._ready, self._weakref)

Expand Down Expand Up @@ -196,17 +196,16 @@ async def cancel():
if not self._conn.isexecuting():
return
try:
await asyncio.wait_for(self._waiter, timeout,
loop=self._loop)
await asyncio.wait_for(self._waiter, timeout)
except psycopg2.extensions.QueryCanceledError:
pass
except asyncio.TimeoutError:
self._close()

try:
await asyncio.wait_for(self._waiter, timeout, loop=self._loop)
await asyncio.wait_for(self._waiter, timeout)
except (asyncio.CancelledError, asyncio.TimeoutError) as exc:
await asyncio.shield(cancel(), loop=self._loop)
await asyncio.shield(cancel())
raise exc
except psycopg2.extensions.QueryCanceledError as exc:
self._loop.call_exception_handler({
Expand Down Expand Up @@ -372,7 +371,7 @@ async def cancel():
except psycopg2.extensions.QueryCanceledError:
pass

await asyncio.shield(cancel(), loop=self._loop)
await asyncio.shield(cancel())

async def reset(self):
raise psycopg2.ProgrammingError(
Expand Down
2 changes: 1 addition & 1 deletion aiopg/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, dsn, minsize, maxsize, timeout, *,
self._conn_kwargs = kwargs
self._acquiring = 0
self._free = collections.deque(maxlen=maxsize or None)
self._cond = asyncio.Condition(loop=self._loop)
self._cond = asyncio.Condition()
self._used = set()
self._terminated = set()
self._closing = False
Expand Down

0 comments on commit 1ccd947

Please sign in to comment.