"Iterator[BodyPartReader]" has no attribute "__anext__" #5163
Closed
Description
🐞 Describe the bug
BodyPartReader.__aiter__()
is declared to return Iterator
instead of AsyncIterator
. Introduced in 3b70bad (#4931).
💡 To Reproduce
Snippet to reproduce:
# rep.py
from aiohttp import web
async def handler(request: web.Request) -> None:
reader = await request.multipart()
async for field in reader:
...
💡 Expected behavior
No errors returned by mypy.
📋 Logs/tracebacks
$ mypy rep.py
rep.py:5: error: "Iterator[BodyPartReader]" has no attribute "__anext__"; maybe "__next__"?
Found 1 error in 1 file (checked 1 source file)
📋 Your version of the Python
$ python --version
Python 3.8.6
📋 Your version of the aiohttp/yarl/multidict distributions
$ python -m pip show aiohttp
Name: aiohttp
Version: 3.7.2
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author: Nikolay Kim
Author-email: fafhrd91@gmail.com
License: Apache 2
Location: /private/tmp/aiohttpbug/.venv/lib/python3.8/site-packages
Requires: multidict, chardet, yarl, async-timeout, typing-extensions, attrs
Required-by:
$ python -m pip show multidict
# irrelevant
$ python -m pip show yarl
# irrelevant
📋 Additional context
Version of mypy:
$ python -m pip show mypy
Name: mypy
Version: 0.790
Summary: Optional static typing for Python
Home-page: http://www.mypy-lang.org/
Author: Jukka Lehtosalo
Author-email: jukka.lehtosalo@iki.fi
License: MIT License
Location: /private/tmp/aiohttpbug/.venv/lib/python3.8/site-packages
Requires: typed-ast, typing-extensions, mypy-extensions
Required-by: