mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
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.
This commit is contained in:
parent
136735c1a2
commit
1b335ae281
5 changed files with 24 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue