New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-39259: poplib.POP3/POP3_SSL now reject timeout = 0 #17912
Conversation
Lib/test/test_poplib.py
Outdated
| @@ -505,17 +505,17 @@ def server(self, evt, serv): | |||
|
|
|||
| def testTimeoutDefault(self): | |||
| self.assertIsNone(socket.getdefaulttimeout()) | |||
| socket.setdefaulttimeout(30) | |||
| socket.setdefaulttimeout(test_support.SHORT_TIMEOUT) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I added timeout constants to the test.support module, I decided to leave this test unchanged. I understood that the test doesn't connect to real socket. Or does it? I'm not sure. If it does, LOOPBACK_TIMEOUT is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 107 in eef1b02
| self.welcome = self._getresp() |
As you can see poplib client's constructor actually makes a connection to the server and get a response.
cpython/Lib/test/test_poplib.py
Line 484 in eef1b02
| self.thread = threading.Thread(target=self.server, args=(self.evt,self.sock)) |
So this test intends to check whether poplib client is set by a global socket timeout and also check whether the connection is succeeded.
|
@vstinner I have made the requested changes; please review again |
|
Thanks for making the requested changes! : please review the changes made to this pull request. |
Co-Authored-By: Victor Stinner <vstinner@python.org>
Co-Authored-By: Victor Stinner <vstinner@python.org>
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.
https://bugs.python.org/issue39259