gh-56915: Fix documented timeout default in ftplib and poplib - #158630
Open
Monstertov wants to merge 1 commit into
Open
Monstertov wants to merge 1 commit into
Monstertov wants to merge 1 commit into
Conversation
the docs showed timeout=None for FTP, FTP.connect, FTP_TLS and POP3_SSL, but the code defaults to the global socket timeout. passing None disables the timeout instead. use the [, timeout] form like smtplib and http.client, and say that FTP.connect keeps the constructor timeout.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Documentation build overview
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the docs show
timeout=Noneas the default forFTP,FTP.connect,FTP_TLSandPOP3_SSL, but none of them actually default toNone:FTP,FTP_TLSandPOP3_SSLdefault tosocket._GLOBAL_DEFAULT_TIMEOUT, so the global default timeout is used. passingNoneexplicitly disables the timeout, which is the surprise described in the issue.FTP.connectuses a private sentinel and keeps the timeout that was given to the constructor.this switches those signatures to the
[, timeout]form thatsmtplib,http.client,urllib.requestandPOP3already use, fixes the default text forFTP.connect, and corrects theFTPclass docstring, which said the timeout defaults toNone.docs and docstring only, no behaviour change, so i think this can skip news.
quick check of the current behaviour: