From c39b52f1527868c7ada9385669c38edf98858921 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Fri, 10 Jan 2020 23:34:05 +0900 Subject: 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. --- Lib/poplib.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/poplib.py') diff --git a/Lib/poplib.py b/Lib/poplib.py index 0b6750d230..0f8587317c 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): -- cgit v1.2.1