Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseConnector limit if of type int but documentation suggests None as an option #8514

Closed
1 task done
nono1515 opened this issue Jul 18, 2024 · 1 comment
Closed
1 task done
Labels

Comments

@nono1515
Copy link

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.8

aiohttp 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/aiohttp

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 6.0.5
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.9.4
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl

OS

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
@nono1515 nono1515 added the bug label Jul 18, 2024
@Dreamsorcerer
Copy link
Member

Please use 0: #8930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants