Skip to content

Commit

Permalink
Do not pass "loop" parameter to asyncio.Lock() on Python 3.10+
Browse files Browse the repository at this point in the history
  • Loading branch information
lhadvantek committed Nov 11, 2021
1 parent 676e6d9 commit 7aff2d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aiofcm/connection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import json
import asyncio
from typing import Optional, NoReturn
Expand Down Expand Up @@ -168,7 +169,11 @@ def __init__(self, sender_id, api_key, max_connections=10, loop=None):
self.max_connections = max_connections
self.loop = loop or asyncio.get_event_loop()
self.connections = []
self._lock = asyncio.Lock(loop=self.loop)
# Python 3.10+ does not use the "loop" parameter
if sys.hexversion >= 0x030A00F0:
self._lock = asyncio.Lock()
else:
self._lock = asyncio.Lock(loop=self.loop)

self.loop.set_exception_handler(self.__exception_handler)

Expand Down

0 comments on commit 7aff2d3

Please sign in to comment.