-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Describe the bug
aiohttp.BaseConnector has an option limit which is an int according to Python typing. However, the doc mentions limit (int – total number simultaneous connections. If limit is None the connector has no limit (default: 100).. Then, when setting this option to None, Mypy complains
Argument "limit" to "TCPConnector" has incompatible type "None"; expected "int" - mypy arg-type
Proposed solution: set the type value of limit to Optionnal[int] or int | None in BaseConnector and other connectors
To Reproduce
# main.py
connector = aiohttp.TCPConnector(limit=None)$ mypy main.py
error: Argument "limit" to "TCPConnector" has incompatible type "None"; expected "int" [arg-type]Expected behavior
Mypy raises no error.
Logs/tracebacks
error: Argument "limit" to "TCPConnector" has incompatible type "None"; expected "int" [arg-type]Python Version
$ python --version
Python 3.11.8aiohttp Version
$ python -m pip show aiohttp
Name: aiohttp
Version: 3.9.3
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttpmultidict Version
$ python -m pip show multidict
Name: multidict
Version: 6.0.5
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidictyarl Version
$ python -m pip show yarl
Name: yarl
Version: 1.9.4
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarlOS
WSL Ubuntu on Windows 10
Related component
Client
Additional context
No response
Code of Conduct
- I agree to follow the aio-libs Code of Conduct
Reactions are currently unavailable