classification
Title: poplib.POP3/POP3_SSL should reject timeout = 0 (non-blocking mode)
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: corona10, vstinner
Priority: normal Keywords: patch

Created on 2020-01-08 14:55 by corona10, last changed 2020-01-14 12:05 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17912 merged corona10, 2020-01-09 02:00
PR 17936 merged corona10, 2020-01-10 14:28
PR 17939 merged corona10, 2020-01-10 16:47
PR 17958 merged corona10, 2020-01-12 07:37
PR 17959 merged corona10, 2020-01-12 08:25
Messages (13)
msg359596 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-01-08 14:55
Since poplib.POP3/POP3_SSL's implementation depends on socket.makefile, the client should reject if the timeout is zero.
Because socket.makefile said that 'The socket must be in blocking mode' and if we set timeout to zero, the client does not operate as normal.
msg359599 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-08 15:47
I agree, I was the one who suggest to reject timeout=0 when you added the parameter to imaplib :-)

Do you want to work on a PR?
msg359604 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-01-08 16:07
Sure, I will submit the PR by tomorrow :)
msg359646 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-01-09 02:22
ftplib: https://github.com/python/cpython/blob/efa3b51fd060352cc6220b27a1026e4d4d5401bd/Lib/ftplib.py#L155
nntplib: https://github.com/python/cpython/blob/2e6a8efa837410327b593dc83c57492253b1201e/Lib/nntplib.py#L1049
smtplib: https://github.com/python/cpython/blob/3faf826e5879536d2272f1a51c58965a16827f81/Lib/smtplib.py#L386


I found more things that depends on socket.makefile.
IMHO, we can apply this change to those modules. What do you think?
msg359660 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-09 09:18
ftplib: https://github.com/python/cpython/blob/efa3b51fd060352cc6220b27a1026e4d4d5401bd/Lib/ftplib.py#L155
nntplib: https://github.com/python/cpython/blob/2e6a8efa837410327b593dc83c57492253b1201e/Lib/nntplib.py#L1049
smtplib: https://github.com/python/cpython/blob/3faf826e5879536d2272f1a51c58965a16827f81/Lib/smtplib.py#L386

It seems like these 3 modules use makefile() and have a timeout parameter. If makefile() doesn't support non-blocking mode, sure, it's a good idea to also reject explicitly timeout=0 in these modules.
msg359727 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-10 14:34
New changeset c39b52f1527868c7ada9385669c38edf98858921 by Victor Stinner (Dong-hee Na) in branch 'master':
bpo-39259: poplib now rejects timeout = 0 (GH-17912)
https://github.com/python/cpython/commit/c39b52f1527868c7ada9385669c38edf98858921
msg359799 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-11 15:07
New changeset 5d978a2e73e9ad934bcd260ae0a0db5cd0ca27d0 by Victor Stinner (Dong-hee Na) in branch 'master':
bpo-39259: nntplib.NNTP/NNTP_SSL refactoring (GH-17939)
https://github.com/python/cpython/commit/5d978a2e73e9ad934bcd260ae0a0db5cd0ca27d0
msg359815 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-11 17:39
New changeset 1b335ae281631a12201fdec29b3c55d97166fc06 by Victor Stinner (Dong-hee Na) in branch 'master':
bpo-39259: nntplib.NNTP/NNTP_SSL now reject timeout = 0 (GH-17936)
https://github.com/python/cpython/commit/1b335ae281631a12201fdec29b3c55d97166fc06
msg359930 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-13 19:34
New changeset a190e2ade1a704a6b5a94464a0a19b140c7dd031 by Victor Stinner (Dong-hee Na) in branch 'master':
bpo-39259: ftplib.FTP/FTP_TLS now reject timeout = 0 (GH-17959)
https://github.com/python/cpython/commit/a190e2ade1a704a6b5a94464a0a19b140c7dd031
msg359951 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-14 07:50
New changeset 62e3973395fb9fab2eb8f651bcd0fea4e695e1cf by Victor Stinner (Dong-hee Na) in branch 'master':
bpo-39259: smtp.SMTP/SMTP_SSL now reject timeout = 0 (GH-17958)
https://github.com/python/cpython/commit/62e3973395fb9fab2eb8f651bcd0fea4e695e1cf
msg359952 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-14 07:50
Can we now close this issue? Or is there still something to do?
msg359954 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-01-14 08:10
> Can we now close this issue? Or is there still something to do?

There is no case on xxlib series except LMTP.
I am going to open a new issue about LMTP.
So let's close this :)
msg359968 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-14 12:05
Thanks Dong-hee Na for all these nice changes!
History
Date User Action Args
2020-01-14 12:05:40vstinnersetmessages: + msg359968
2020-01-14 12:05:17vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-01-14 08:10:54corona10setmessages: + msg359954
2020-01-14 07:50:46vstinnersetmessages: + msg359952
2020-01-14 07:50:06vstinnersetmessages: + msg359951
2020-01-13 19:34:40vstinnersetmessages: + msg359930
2020-01-12 08:25:08corona10setpull_requests: + pull_request17367
2020-01-12 07:37:48corona10setpull_requests: + pull_request17366
2020-01-11 17:39:18vstinnersetmessages: + msg359815
2020-01-11 15:07:58vstinnersetmessages: + msg359799
2020-01-10 16:47:43corona10setpull_requests: + pull_request17351
2020-01-10 14:34:12vstinnersetmessages: + msg359727
2020-01-10 14:28:44corona10setpull_requests: + pull_request17344
2020-01-09 09:18:40vstinnersetmessages: + msg359660
2020-01-09 02:22:24corona10setmessages: + msg359646
2020-01-09 02:00:45corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request17323
2020-01-08 16:07:25corona10setmessages: + msg359604
2020-01-08 15:47:40vstinnersettitle: poplib.POP3/POP3_SSL should reject timeout = 0 -> poplib.POP3/POP3_SSL should reject timeout = 0 (non-blocking mode)
2020-01-08 15:47:29vstinnersetmessages: + msg359599
2020-01-08 14:55:46corona10create