Skip to content

Commit

Permalink
[3.6] Use Iterable hint instead of Sequence (#4125)
Browse files Browse the repository at this point in the history
Given that the `FrozenList` type hint is `Union[List[_T], Iterable[_T]]`
the Application middleware type should not restrict to `Sequence` and
support all `Iterable` types..
(cherry picked from commit 8475395)

Co-authored-by: Stefan T <66305+stj@users.noreply.github.com>
  • Loading branch information
stj authored and asvetlov committed Oct 2, 2019
1 parent ecb6dfa commit ff7bf6a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/4125.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `Iterable` hint instead of `Sequence` for `Application` `middleware` parameter.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Simon Kennedy
Sin-Woo Bang
Stanislas Plum
Stanislav Prokop
Stefan Tjarks
Stepan Pletnev
Stephen Granade
Steven Seguin
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/web_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Application(MutableMapping[str, Any]):
def __init__(self, *,
logger: logging.Logger=web_logger,
router: Optional[UrlDispatcher]=None,
middlewares: Sequence[_Middleware]=(),
middlewares: Iterable[_Middleware]=(),
handler_args: Mapping[str, Any]=None,
client_max_size: int=1024**2,
loop: Optional[asyncio.AbstractEventLoop]=None,
Expand Down

0 comments on commit ff7bf6a

Please sign in to comment.