Skip to content

Commit 87df3b9

Browse files
committed
🐛 Fix Python3.11+ raises ModuleNotFoundError: No module named typing_extensions
1 parent bc525f3 commit 87df3b9

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

asyncer/_compat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# AnyIO 4.1.0 renamed cancellable to abandon_on_cancel
22
import importlib
33
import importlib.metadata
4+
import sys
45
from typing import Callable, TypeVar, Union
56

67
import anyio
78
import anyio.to_thread
89
from anyio import CapacityLimiter
9-
from typing_extensions import TypeVarTuple, Unpack
10+
11+
if sys.version_info >= (3, 11):
12+
from typing import TypeVarTuple, Unpack
13+
else:
14+
from typing_extensions import TypeVarTuple, Unpack
1015

1116
ANYIO_VERSION = importlib.metadata.version("anyio")
1217

asyncer/_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async def do_work(name: str) -> str:
135135
async with asyncer.create_task_group() as task_group:
136136
result1 = task_group.soonify(do_work)(name="task 1")
137137
result2 = task_group.soonify(do_work)(name="task 2")
138-
await anyio.sleep(0)
138+
await anyio.lowlevel.checkpoint()
139139
if not result1.pending:
140140
print(result1.value)
141141
if not result2.pending:

poetry.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ classifiers = [
3232
]
3333
dependencies = [
3434
"anyio >=3.4.0,<5.0",
35-
"typing_extensions >=4.8.0; python_version < '3.10'"
35+
"typing_extensions >=4.8.0; python_version < '3.11'"
3636
]
3737

3838
[project.urls]

0 commit comments

Comments
 (0)