diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-29 21:09:56 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-29 21:09:56 (GMT) |
| commit | 66565649b53b39a11306d96935be8a4810a70f3f (patch) | |
| tree | 852dc7f6f6272a6cfb1433a3067dac569adb3d08 /Lib/asyncio/proactor_events.py | |
| parent | acc6e7596f515c2e0a3376a5ef647f531f22a824 (diff) | |
| parent | 9c9f1f10d391ff3458a80fc3d0110870d50012e2 (diff) | |
| download | cpython-66565649b53b39a11306d96935be8a4810a70f3f.zip cpython-66565649b53b39a11306d96935be8a4810a70f3f.tar.gz cpython-66565649b53b39a11306d96935be8a4810a70f3f.tar.bz2 | |
Merge with Python 3.4 (asyncio)
- 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.
- asyncio: Use the new os.set_blocking() function of Python 3.5 if available
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
| -rw-r--r-- | Lib/asyncio/proactor_events.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index ab566b3..751155b 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -385,12 +385,18 @@ class BaseProactorEventLoop(base_events.BaseEventLoop): self._selector = None def sock_recv(self, sock, n): + if self.get_debug() and sock.gettimeout() != 0: + raise ValueError("the socket must be non-blocking") return self._proactor.recv(sock, n) def sock_sendall(self, sock, data): + if self.get_debug() and sock.gettimeout() != 0: + raise ValueError("the socket must be non-blocking") return self._proactor.send(sock, data) def sock_connect(self, sock, address): + if self.get_debug() and sock.gettimeout() != 0: + raise ValueError("the socket must be non-blocking") try: base_events._check_resolved_address(sock, address) except ValueError as err: @@ -401,6 +407,8 @@ class BaseProactorEventLoop(base_events.BaseEventLoop): return self._proactor.connect(sock, address) def sock_accept(self, sock): + if self.get_debug() and sock.gettimeout() != 0: + raise ValueError("the socket must be non-blocking") return self._proactor.accept(sock) def _socketpair(self): |
