gh-56915: Fix documented timeout default in ftplib - #158630
Monstertov wants to merge 3 commits 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
10 files changed ·
|
|
The What I recommend here is to revisit #91225 in light of the introduction of sentinel support in Python. That doesn't fix the inconsistency in the docs for the maintenance versions, but I don't think the change suggested in this PR is the correct approach to fixing that. Any suggestion for a doc-only fix should also be applied to those other arguably incorrect (and I believe legacy) uses of |
|
thanks, agreed. as i see it, two options:
the |
|
I think So let's go with the non-signature fixes only here, and fix the signatures after adding the sentinels.. |
Revert the signature-notation changes per review; the proper signature fix is deferred to a follow-up that adds real timeout sentinels. This keeps the FTP.connect default-timeout text and the FTP class docstring corrections.
|
@bitdancer done. dropped the signature changes and kept only the non-signature fixes: the i'll do the signatures in a follow-up after the sentinels land (#91225). |
|
the MSan failure ( |
the
FTP.connectdocs and theFTPclass docstring both describe the wrong default for timeout:FTP.connectuses a private sentinel. omitting timeout preserves the instance's timeout, initially set by the constructor.FTPdefaults tosocket._GLOBAL_DEFAULT_TIMEOUT, so sockets use the global default timeout. passingNoneexplicitly disables the timeout.this fixes the
FTP.connectdefault text and theFTPclass docstring. thetimeout=Nonesignatures in the docs are left as is for now, see the discussion above.docs and docstring only, no behaviour change, so i think this can skip news.
quick check of the socket timeout after a successful connection: