From 1b335ae281631a12201fdec29b3c55d97166fc06 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sun, 12 Jan 2020 02:39:15 +0900 Subject: bpo-39259: nntplib.NNTP/NNTP_SSL now reject timeout = 0 (GH-17936) nntplib.NNTP and nntplib.NNTP_SSL now raise a ValueError if the given timeout for their constructor is zero to prevent the creation of a non-blocking socket. --- Lib/nntplib.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/nntplib.py') diff --git a/Lib/nntplib.py b/Lib/nntplib.py index 0ab51853b5..8951203f32 100644 --- a/Lib/nntplib.py +++ b/Lib/nntplib.py @@ -1056,6 +1056,8 @@ class NNTP(_NNTPBase): raise def _create_socket(self, timeout): + if timeout is not None and not timeout: + raise ValueError('Non-blocking socket (timeout=0) is not supported') sys.audit("nntplib.connect", self, self.host, self.port) return socket.create_connection((self.host, self.port), timeout) -- cgit v1.2.1