diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-09-14 20:53:54 +0300 |
---|---|---|
committer | Matti Picus <matti.picus@gmail.com> | 2020-09-14 20:53:54 +0300 |
commit | 6a11f6822c83c0761e2ddea8588c05faf0a8b904 (patch) | |
tree | 0dd7d1b8766f0a4001be2811f677b429789b1cac /lib-python/3/asyncio/selector_events.py | |
parent | do not display IRC_TOPIC even on this alpha release. Can be overridden from env (diff) | |
parent | merge default into py3.7 (diff) | |
download | pypy-6a11f6822c83c0761e2ddea8588c05faf0a8b904.tar.gz pypy-6a11f6822c83c0761e2ddea8588c05faf0a8b904.tar.bz2 pypy-6a11f6822c83c0761e2ddea8588c05faf0a8b904.zip |
merge py3.7 into release3.7.xrelease-pypy3.7-v7.3.2rc2
Diffstat (limited to 'lib-python/3/asyncio/selector_events.py')
-rw-r--r-- | lib-python/3/asyncio/selector_events.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib-python/3/asyncio/selector_events.py b/lib-python/3/asyncio/selector_events.py index 23bd8ad849..fa8f0cd759 100644 --- a/lib-python/3/asyncio/selector_events.py +++ b/lib-python/3/asyncio/selector_events.py @@ -39,6 +39,11 @@ def _test_selector_event(selector, fd, event): return bool(key.events & event) +def _check_ssl_socket(sock): + if ssl is not None and isinstance(sock, ssl.SSLSocket): + raise TypeError("Socket cannot be of type SSLSocket") + + class BaseSelectorEventLoop(base_events.BaseEventLoop): """Selector event loop. @@ -345,6 +350,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): The maximum amount of data to be received at once is specified by nbytes. """ + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -378,6 +384,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): The received data is written into *buf* (a writable buffer). The return value is the number of bytes written. """ + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -415,6 +422,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): raised, and there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection. """ + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() @@ -451,6 +459,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): This method is a coroutine. """ + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") @@ -508,6 +517,7 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop): object usable to send and receive data on the connection, and address is the address bound to the socket on the other end of the connection. """ + _check_ssl_socket(sock) if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") fut = self.create_future() |