Skip to content

Commit 1515486

Browse files
committed
use sys.version_info tuple instead of minor attribute
1 parent d6dd535 commit 1515486

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/openai/_utils/_sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313

1414

15-
if sys.version_info.minor < 9:
15+
if sys.version_info >= (3, 9):
16+
to_thread: Callable[..., Awaitable[Any]] = asyncio.to_thread
17+
else:
1618
async def _to_thread(
1719
func: Callable[..., Any], /, *args: List[Any], **kwargs: Dict[str, Any]
1820
) -> Any:
@@ -31,8 +33,6 @@ async def _to_thread(
3133
return await loop.run_in_executor(None, func_call)
3234

3335
to_thread: Callable[..., Awaitable[Any]] = _to_thread
34-
else:
35-
to_thread: Callable[..., Awaitable[Any]] = asyncio.to_thread # type: ignore - to_thread is only defined in python 3.9+
3636

3737
# copied from `asyncer`, https://github.com/tiangolo/asyncer
3838
def asyncify(

0 commit comments

Comments
 (0)