mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
bpo-39259: poplib now rejects timeout = 0 (GH-17912)
poplib.POP3 and poplib.POP3_SSL now raise a ValueError if the given timeout for their constructor is zero to prevent the creation of a non-blocking socket.
This commit is contained in:
parent
4c53e63cc9
commit
c39b52f152
5 changed files with 26 additions and 6 deletions
|
@ -107,6 +107,8 @@ class POP3:
|
|||
self.welcome = self._getresp()
|
||||
|
||||
def _create_socket(self, timeout):
|
||||
if timeout is not None and not timeout:
|
||||
raise ValueError('Non-blocking socket (timeout=0) is not supported')
|
||||
return socket.create_connection((self.host, self.port), timeout)
|
||||
|
||||
def _putline(self, line):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue