-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
Description
Bug report
Bug description:
import asyncio
import socket
s = socket.socket()
await asyncio.get_running_loop().sock_connect(s,('127.0.0.1',80))
according to https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.sock_connect and
cpython/Lib/asyncio/selector_events.py
Lines 617 to 630 in 5d8a3e7
async def sock_connect(self, sock, address): | |
"""Connect to a remote socket at address. | |
This method is a coroutine. | |
""" | |
base_events._check_ssl_socket(sock) | |
if self._debug and sock.gettimeout() != 0: | |
raise ValueError("the socket must be non-blocking") | |
if sock.family == socket.AF_INET or ( | |
base_events._HAS_IPv6 and sock.family == socket.AF_INET6): | |
resolved = await self._ensure_resolved( | |
address, family=sock.family, type=sock.type, proto=sock.proto, | |
loop=self, |
it should raise. however,
ProactorEventLoop
doesn't follow the rule
should we fix this, any thoughts
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs
- gh-113892: Add a extra check to
ProactorEventLoop.sock_connect
to ensure that the given socket is in non-blocking mode #119519 - [3.13] gh-113892: Add a extra check to
ProactorEventLoop.sock_connect
to ensure that the given socket is in non-blocking mode (GH-119519) #119912 - [3.12] gh-113892: Add a extra check to
ProactorEventLoop.sock_connect
to ensure that the given socket is in non-blocking mode (GH-119519) #119913
Metadata
Metadata
Assignees
Labels
Projects
Status
Done