mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Close #22063: socket operations (socket,recv, sock_sendall, sock_connect,
sock_accept) now raise an exception in debug mode if sockets are in blocking mode.
This commit is contained in:
parent
f2ed889027
commit
9c9f1f10d3
3 changed files with 34 additions and 0 deletions
|
@ -256,6 +256,8 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
|||
|
||||
This method is a coroutine.
|
||||
"""
|
||||
if self.get_debug() and sock.gettimeout() != 0:
|
||||
raise ValueError("the socket must be non-blocking")
|
||||
fut = futures.Future(loop=self)
|
||||
self._sock_recv(fut, False, sock, n)
|
||||
return fut
|
||||
|
@ -292,6 +294,8 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
|||
|
||||
This method is a coroutine.
|
||||
"""
|
||||
if self.get_debug() and sock.gettimeout() != 0:
|
||||
raise ValueError("the socket must be non-blocking")
|
||||
fut = futures.Future(loop=self)
|
||||
if data:
|
||||
self._sock_sendall(fut, False, sock, data)
|
||||
|
@ -333,6 +337,8 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
|||
|
||||
This method is a coroutine.
|
||||
"""
|
||||
if self.get_debug() and sock.gettimeout() != 0:
|
||||
raise ValueError("the socket must be non-blocking")
|
||||
fut = futures.Future(loop=self)
|
||||
try:
|
||||
base_events._check_resolved_address(sock, address)
|
||||
|
@ -374,6 +380,8 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
|||
|
||||
This method is a coroutine.
|
||||
"""
|
||||
if self.get_debug() and sock.gettimeout() != 0:
|
||||
raise ValueError("the socket must be non-blocking")
|
||||
fut = futures.Future(loop=self)
|
||||
self._sock_accept(fut, False, sock)
|
||||
return fut
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue