summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/selector_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-29 21:08:17 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-29 21:08:17 (GMT)
commit9c9f1f10d391ff3458a80fc3d0110870d50012e2 (patch)
tree91366a85b6b7bb730cce303233aa0914aff8dbd9 /Lib/asyncio/selector_events.py
parentf2ed889027f23ecf184a6ef52b7a7cc4921c3000 (diff)
downloadcpython-9c9f1f10d391ff3458a80fc3d0110870d50012e2.zip
cpython-9c9f1f10d391ff3458a80fc3d0110870d50012e2.tar.gz
cpython-9c9f1f10d391ff3458a80fc3d0110870d50012e2.tar.bz2
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.
Diffstat (limited to 'Lib/asyncio/selector_events.py')
-rw-r--r--Lib/asyncio/selector_events.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index eca48b8..6b7bdf0 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -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