Closed
Description
Describe the bug
It looks like a breaking change in the latest version.
In version 3.9.5 it works:
import aiohttp
connector = aiohttp.TCPConnector()
(in a more complex example I get a warning (DeprecationWarning: The object should be created within an async function))
but in 3.10 I get an exception:
Traceback (most recent call last):
File "/tmp/a1.py", line 5, in <module>
connector = aiohttp.TCPConnector()
File "/home/tomek/work/github/kubernetes-client/kubernetes_asyncio-new/VENV/lib/python3.10/site-packages/aiohttp/connector.py", line 784, in __init__
super().__init__(
File "/home/tomek/work/github/kubernetes-client/kubernetes_asyncio-new/VENV/lib/python3.10/site-packages/aiohttp/connector.py", line 234, in __init__
loop = loop or asyncio.get_running_loop()
RuntimeError: no running event loop
To Reproduce
code
import aiohttp
connector = aiohttp.TCPConnector()
Expected behavior
If the change is intentional it would be very useful to describe that in a changelog.
If not I expect the same behavior like in the previous version.
Logs/tracebacks
Traceback (most recent call last):
File "/tmp/a1.py", line 5, in <module>
connector = aiohttp.TCPConnector()
File "/home/tomek/work/github/kubernetes-client/kubernetes_asyncio-new/VENV/lib/python3.10/site-packages/aiohttp/connector.py", line 784, in __init__
super().__init__(
File "/home/tomek/work/github/kubernetes-client/kubernetes_asyncio-new/VENV/lib/python3.10/site-packages/aiohttp/connector.py", line 234, in __init__
loop = loop or asyncio.get_running_loop()
RuntimeError: no running event loop
### Python Version
```console
$ python --version
3.10
aiohttp Version
$ python -m pip show aiohttp
Name: aiohttp
Version: 3.10.0multidict Version
$ python -m pip show multidict
Name: multidict
Version: 6.0.4yarl Version
$ python -m pip show yarl
Name: yarl
Version: 1.8.2OS
Linux
Related component
Client
Additional context
No response
Code of Conduct
- I agree to follow the aio-libs Code of Conduct