-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
asyncio.open_connection(local_addr=('localhost', port)) fails with TypeError: AF_INET address must be a pair (host, port) #86508
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
Comments
Context: CentOS 7.8.2003, Python 3.8 from SCL. localhost has IPv4 and IPv6 bindings, IPv6 first: import asyncio
async def main():
await asyncio.open_connection('localhost', 9990, local_addr=('localhost', 9991))
asyncio.run(main()) Traceback (most recent call last):
File "async.py", line 4, in <module>
asyncio.run(main())
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 608, in run_until_complete
return future.result()
File "async.py", line 3, in main
await asyncio.open_connection('10.10.10.10', 9990, local_addr=('localhost', 9991))
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/streams.py", line 52, in open_connection
transport, _ = await loop.create_connection(
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 1002, in create_connection
sock = await self._connect_sock(
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 904, in _connect_sock
sock.bind(laddr)
TypeError: AF_INET address must be a pair (host, port) It looks like this has a similar root cause to bpo-35302 - we should be filtering local addrinfos by family for valid combinations. |
…ncio.open_connection` (#100615)
…n `asyncio.open_connection` (pythonGH-100615) (cherry picked from commit ba8dcdb) Co-authored-by: Kumar Aditya <[email protected]>
…n `asyncio.open_connection` (pythonGH-100615) (cherry picked from commit ba8dcdb) Co-authored-by: Kumar Aditya <[email protected]>
…ncio.open_connection` (GH-100615) (cherry picked from commit ba8dcdb) Co-authored-by: Kumar Aditya <[email protected]>
…ncio.open_connection` (GH-100615) (cherry picked from commit ba8dcdb) Co-authored-by: Kumar Aditya <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
asyncio.open_connection
#100615asyncio.open_connection
(GH-100615) #100741asyncio.open_connection
(GH-100615) #100742The text was updated successfully, but these errors were encountered: