Skip to content

Commit eaa2f3a

Browse files
committed
Avoid deprecation warning
1 parent 563d818 commit eaa2f3a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/graphql/execution/map_async_iterator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from asyncio import CancelledError, Event, Task, ensure_future, wait
22
from concurrent.futures import FIRST_COMPLETED
33
from inspect import isasyncgen, isawaitable
4-
from typing import cast, Any, AsyncIterable, Callable, Optional, Set, Type, Union
54
from types import TracebackType
5+
from typing import Any, AsyncIterable, Callable, Optional, Set, Type, Union, cast
66

77
__all__ = ["MapAsyncIterator"]
88

@@ -73,9 +73,13 @@ async def athrow(
7373
"""Throw an exception into the asynchronous iterator."""
7474
if self.is_closed:
7575
return
76+
if isinstance(type_, BaseException):
77+
value = type_
78+
type_ = type(value)
79+
traceback = value.__traceback__
7680
athrow = getattr(self.iterator, "athrow", None)
7781
if athrow:
78-
await athrow(type_, value, traceback)
82+
await athrow(type_ if value is None else value)
7983
else:
8084
await self.aclose()
8185
if value is None:

0 commit comments

Comments
 (0)