Skip to content

Commit

Permalink
fix: _GenericAlias has no attribute __name__ (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Nov 21, 2024
1 parent 970e463 commit 91abc69
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions a_sync/iter.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import logging
import sys
import weakref
from types import FunctionType
from typing import get_args
from typing import _GenericAlias, get_args

from async_property import async_cached_property

Expand Down Expand Up @@ -140,6 +140,7 @@ class _AwaitableAsyncIterableMixin(AsyncIterable[T]):
type_string = str(type_argument)
# modify the class docstring
example_text = type_argument._name if isinstance(type_argument, _GenericAlias) else name
cdef str new_chunk = (
"When awaited, a list of all {} will be returned.\n".format(type_string) +
"\n"
Expand All @@ -148,7 +149,7 @@ class _AwaitableAsyncIterableMixin(AsyncIterable[T]):
" >>> all_contents = await my_object\n"
" >>> isinstance(all_contents, list)\n"
" True\n"
" >>> isinstance(all_contents[0], {})\n".format(type_argument.__name__) +
" >>> isinstance(all_contents[0], {})\n".format(example_text) +
" True\n"
)
Expand Down

0 comments on commit 91abc69

Please sign in to comment.