Skip to content

Commit 911c487

Browse files
committed
Fix pre-3.9 async imports
1 parent c313064 commit 911c487

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pymongo/asynchronous/helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ async def inner(*args: Any, **kwargs: Any) -> Any:
7070

7171
if sys.version_info >= (3, 10):
7272
anext = builtins.anext
73+
aiter = builtins.aiter
7374
else:
7475

7576
async def anext(cls: Any) -> Any:
7677
"""Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext."""
7778
return await cls.__anext__()
79+
80+
async def aiter(cls: Any) -> Any:
81+
"""Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext."""
82+
return await cls.__aiter__()

pymongo/synchronous/helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ def inner(*args: Any, **kwargs: Any) -> Any:
7070

7171
if sys.version_info >= (3, 10):
7272
next = builtins.next
73+
iter = builtins.iter
7374
else:
7475

7576
def next(cls: Any) -> Any:
7677
"""Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#next."""
7778
return cls.__next__()
79+
80+
def iter(cls: Any) -> Any:
81+
"""Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#next."""
82+
return cls.__iter__()

0 commit comments

Comments
 (0)