diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2020-01-10 14:34:05 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@python.org> | 2020-01-10 14:34:05 (GMT) |
commit | c39b52f1527868c7ada9385669c38edf98858921 (patch) | |
tree | dff7a3c55d0d8c5f01bcb20bc66fac69aa2cd6dd /Lib/poplib.py | |
parent | 4c53e63cc966f98e141a09bc435b9f9c713b152d (diff) | |
download | cpython-c39b52f1527868c7ada9385669c38edf98858921.zip cpython-c39b52f1527868c7ada9385669c38edf98858921.tar.gz cpython-c39b52f1527868c7ada9385669c38edf98858921.tar.bz2 |
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.
Diffstat (limited to 'Lib/poplib.py')
-rw-r--r-- | Lib/poplib.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/poplib.py b/Lib/poplib.py index 0b6750d..0f85873 100644 --- a/Lib/poplib.py +++ b/Lib/poplib.py @@ -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): |