Skip to content

Commit 9eca723

Browse files
hugovkhauntsaninjaslateny
authored
gh-94172: Update docs for params removed in 3.12 (#100431)
Co-authored-by: Shantanu <[email protected]> Co-authored-by: Stanley <[email protected]>
1 parent 025b5c3 commit 9eca723

File tree

7 files changed

+58
-56
lines changed

7 files changed

+58
-56
lines changed

Doc/library/ftplib.rst

+5-6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ The module defines the following items:
8585
The *encoding* parameter was added, and the default was changed from
8686
Latin-1 to UTF-8 to follow :rfc:`2640`.
8787

88-
.. class:: FTP_TLS(host='', user='', passwd='', acct='', keyfile=None, certfile=None, context=None, timeout=None, source_address=None, *, encoding='utf-8')
88+
.. class:: FTP_TLS(host='', user='', passwd='', acct='', *, context=None,
89+
timeout=None, source_address=None, encoding='utf-8')
8990

9091
A :class:`FTP` subclass which adds TLS support to FTP as described in
9192
:rfc:`4217`.
@@ -96,10 +97,6 @@ The module defines the following items:
9697
options, certificates and private keys into a single (potentially
9798
long-lived) structure. Please read :ref:`ssl-security` for best practices.
9899

99-
*keyfile* and *certfile* are a legacy alternative to *context* -- they
100-
can point to PEM-formatted private key and certificate chain files
101-
(respectively) for the SSL connection.
102-
103100
.. versionadded:: 3.2
104101

105102
.. versionchanged:: 3.3
@@ -111,7 +108,6 @@ The module defines the following items:
111108
:data:`ssl.HAS_SNI`).
112109

113110
.. deprecated:: 3.6
114-
115111
*keyfile* and *certfile* are deprecated in favor of *context*.
116112
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
117113
:func:`ssl.create_default_context` select the system's trusted CA
@@ -123,6 +119,9 @@ The module defines the following items:
123119
The *encoding* parameter was added, and the default was changed from
124120
Latin-1 to UTF-8 to follow :rfc:`2640`.
125121

122+
.. versionchanged:: 3.12
123+
The deprecated *keyfile* and *certfile* parameters have been removed.
124+
126125
Here's a sample session using the :class:`FTP_TLS` class::
127126

128127
>>> ftps = FTP_TLS('ftp.pureftpd.org')

Doc/library/http.client.rst

+19-17
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ HTTPS protocols. It is normally not used directly --- the module
2020

2121
.. seealso::
2222

23-
The `Requests package <https://requests.readthedocs.io/en/master/>`_
23+
The `Requests package <https://requests.readthedocs.io/en/latest/>`_
2424
is recommended for a higher-level HTTP client interface.
2525

2626
.. note::
@@ -67,10 +67,9 @@ The module provides the following classes:
6767
*blocksize* parameter was added.
6868

6969

70-
.. class:: HTTPSConnection(host, port=None, key_file=None, \
71-
cert_file=None[, timeout], \
72-
source_address=None, *, context=None, \
73-
check_hostname=None, blocksize=8192)
70+
.. class:: HTTPSConnection(host, port=None, *[, timeout], \
71+
source_address=None, context=None, \
72+
blocksize=8192)
7473

7574
A subclass of :class:`HTTPConnection` that uses SSL for communication with
7675
secure servers. Default port is ``443``. If *context* is specified, it
@@ -96,6 +95,16 @@ The module provides the following classes:
9695
:func:`ssl._create_unverified_context` can be passed to the *context*
9796
parameter.
9897

98+
.. deprecated:: 3.6
99+
*key_file* and *cert_file* are deprecated in favor of *context*.
100+
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
101+
:func:`ssl.create_default_context` select the system's trusted CA
102+
certificates for you.
103+
104+
The *check_hostname* parameter is also deprecated; the
105+
:attr:`ssl.SSLContext.check_hostname` attribute of *context* should
106+
be used instead.
107+
99108
.. versionchanged:: 3.8
100109
This class now enables TLS 1.3
101110
:attr:`ssl.SSLContext.post_handshake_auth` for the default *context* or
@@ -106,16 +115,9 @@ The module provides the following classes:
106115
``http/1.1`` when no *context* is given. Custom *context* should set
107116
ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`.
108117

109-
.. deprecated:: 3.6
110-
111-
*key_file* and *cert_file* are deprecated in favor of *context*.
112-
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
113-
:func:`ssl.create_default_context` select the system's trusted CA
114-
certificates for you.
115-
116-
The *check_hostname* parameter is also deprecated; the
117-
:attr:`ssl.SSLContext.check_hostname` attribute of *context* should
118-
be used instead.
118+
.. versionchanged:: 3.12
119+
The deprecated *key_file*, *cert_file* and *check_hostname* parameters
120+
have been removed.
119121

120122

121123
.. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None)
@@ -344,11 +346,11 @@ HTTPConnection Objects
344346
Set the host and the port for HTTP Connect Tunnelling. This allows running
345347
the connection through a proxy server.
346348

347-
The host and port arguments specify the endpoint of the tunneled connection
349+
The *host* and *port* arguments specify the endpoint of the tunneled connection
348350
(i.e. the address included in the CONNECT request, *not* the address of the
349351
proxy server).
350352

351-
The headers argument should be a mapping of extra HTTP headers to send with
353+
The *headers* argument should be a mapping of extra HTTP headers to send with
352354
the CONNECT request.
353355

354356
For example, to tunnel through a HTTPS proxy server running locally on port

Doc/library/imaplib.rst

+6-9
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Three exceptions are defined as attributes of the :class:`IMAP4` class:
8484
There's also a subclass for secure connections:
8585

8686

87-
.. class:: IMAP4_SSL(host='', port=IMAP4_SSL_PORT, keyfile=None, \
88-
certfile=None, ssl_context=None, timeout=None)
87+
.. class:: IMAP4_SSL(host='', port=IMAP4_SSL_PORT, *, ssl_context=None, \
88+
timeout=None)
8989

9090
This is a subclass derived from :class:`IMAP4` that connects over an SSL
9191
encrypted socket (to use this class you need a socket module that was compiled
@@ -96,12 +96,6 @@ There's also a subclass for secure connections:
9696
(potentially long-lived) structure. Please read :ref:`ssl-security` for
9797
best practices.
9898

99-
*keyfile* and *certfile* are a legacy alternative to *ssl_context* - they
100-
can point to PEM-formatted private key and certificate chain files for
101-
the SSL connection. Note that the *keyfile*/*certfile* parameters are
102-
mutually exclusive with *ssl_context*, a :class:`ValueError` is raised
103-
if *keyfile*/*certfile* is provided along with *ssl_context*.
104-
10599
The optional *timeout* parameter specifies a timeout in seconds for the
106100
connection attempt. If timeout is not given or is None, the global default
107101
socket timeout is used.
@@ -124,6 +118,9 @@ There's also a subclass for secure connections:
124118
.. versionchanged:: 3.9
125119
The optional *timeout* parameter was added.
126120

121+
.. versionchanged:: 3.12
122+
The deprecated *keyfile* and *certfile* parameters have been removed.
123+
127124
The second subclass allows for connections created by a child process:
128125

129126

@@ -564,7 +561,7 @@ An :class:`IMAP4` instance has the following methods:
564561
``search``, the searching *charset* argument is mandatory. There is also a
565562
``uid thread`` command which corresponds to ``thread`` the way that ``uid
566563
search`` corresponds to ``search``. The ``thread`` command first searches the
567-
mailbox for messages that match the given searching criteria using the charset
564+
mailbox for messages that match the given searching criteria using the *charset*
568565
argument for the interpretation of strings in the searching criteria. It then
569566
returns the matching messages threaded according to the specified threading
570567
algorithm.

Doc/library/poplib.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The :mod:`poplib` module provides two classes:
5353
If the *timeout* parameter is set to be zero, it will raise a
5454
:class:`ValueError` to prevent the creation of a non-blocking socket.
5555

56-
.. class:: POP3_SSL(host, port=POP3_SSL_PORT, keyfile=None, certfile=None, timeout=None, context=None)
56+
.. class:: POP3_SSL(host, port=POP3_SSL_PORT, *, timeout=None, context=None)
5757

5858
This is a subclass of :class:`POP3` that connects to the server over an SSL
5959
encrypted socket. If *port* is not specified, 995, the standard POP3-over-SSL
@@ -63,10 +63,6 @@ The :mod:`poplib` module provides two classes:
6363
single (potentially long-lived) structure. Please read :ref:`ssl-security`
6464
for best practices.
6565

66-
*keyfile* and *certfile* are a legacy alternative to *context* - they can
67-
point to PEM-formatted private key and certificate chain files,
68-
respectively, for the SSL connection.
69-
7066
.. audit-event:: poplib.connect self,host,port poplib.POP3_SSL
7167

7268
.. audit-event:: poplib.putline self,line poplib.POP3_SSL
@@ -94,6 +90,9 @@ The :mod:`poplib` module provides two classes:
9490
If the *timeout* parameter is set to be zero, it will raise a
9591
:class:`ValueError` to prevent the creation of a non-blocking socket.
9692

93+
.. versionchanged:: 3.12
94+
The deprecated *keyfile* and *certfile* parameters have been removed.
95+
9796
One exception is defined as an attribute of the :mod:`poplib` module:
9897

9998

Doc/library/smtplib.rst

+14-13
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,17 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
6666
Support for the :keyword:`with` statement was added.
6767

6868
.. versionchanged:: 3.3
69-
source_address argument was added.
69+
*source_address* argument was added.
7070

7171
.. versionadded:: 3.5
7272
The SMTPUTF8 extension (:rfc:`6531`) is now supported.
7373

7474
.. versionchanged:: 3.9
7575
If the *timeout* parameter is set to be zero, it will raise a
76-
:class:`ValueError` to prevent the creation of a non-blocking socket
76+
:class:`ValueError` to prevent the creation of a non-blocking socket.
7777

78-
.. class:: SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, \
79-
certfile=None [, timeout], context=None, \
80-
source_address=None)
78+
.. class:: SMTP_SSL(host='', port=0, local_hostname=None, * [, timeout], \
79+
context=None, source_address=None)
8180

8281
An :class:`SMTP_SSL` instance behaves exactly the same as instances of
8382
:class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is
@@ -90,15 +89,11 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
9089
aspects of the secure connection. Please read :ref:`ssl-security` for
9190
best practices.
9291

93-
*keyfile* and *certfile* are a legacy alternative to *context*, and can
94-
point to a PEM formatted private key and certificate chain file for the
95-
SSL connection.
96-
9792
.. versionchanged:: 3.3
9893
*context* was added.
9994

10095
.. versionchanged:: 3.3
101-
source_address argument was added.
96+
The *source_address* argument was added.
10297

10398
.. versionchanged:: 3.4
10499
The class now supports hostname check with
@@ -116,13 +111,16 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
116111
If the *timeout* parameter is set to be zero, it will raise a
117112
:class:`ValueError` to prevent the creation of a non-blocking socket
118113

114+
.. versionchanged:: 3.12
115+
The deprecated *keyfile* and *certfile* parameters have been removed.
116+
119117
.. class:: LMTP(host='', port=LMTP_PORT, local_hostname=None, \
120118
source_address=None[, timeout])
121119

122120
The LMTP protocol, which is very similar to ESMTP, is heavily based on the
123121
standard SMTP client. It's common to use Unix sockets for LMTP, so our
124122
:meth:`connect` method must support that as well as a regular host:port
125-
server. The optional arguments local_hostname and source_address have the
123+
server. The optional arguments *local_hostname* and *source_address* have the
126124
same meaning as they do in the :class:`SMTP` class. To specify a Unix
127125
socket, you must use an absolute path for *host*, starting with a '/'.
128126

@@ -360,7 +358,7 @@ An :class:`SMTP` instance has the following methods:
360358
be used as argument to the ``AUTH`` command; the valid values are
361359
those listed in the ``auth`` element of :attr:`esmtp_features`.
362360

363-
*authobject* must be a callable object taking an optional single argument:
361+
*authobject* must be a callable object taking an optional single argument::
364362

365363
data = authobject(challenge=None)
366364

@@ -393,7 +391,7 @@ An :class:`SMTP` instance has the following methods:
393391
.. versionadded:: 3.5
394392

395393

396-
.. method:: SMTP.starttls(keyfile=None, certfile=None, context=None)
394+
.. method:: SMTP.starttls(*, context=None)
397395

398396
Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP
399397
commands that follow will be encrypted. You should then call :meth:`ehlo`
@@ -416,6 +414,9 @@ An :class:`SMTP` instance has the following methods:
416414
:func:`ssl.create_default_context` select the system's trusted CA
417415
certificates for you.
418416

417+
.. versionchanged:: 3.12
418+
The deprecated *keyfile* and *certfile* parameters have been removed.
419+
419420
:exc:`SMTPHeloError`
420421
The server didn't reply properly to the ``HELO`` greeting.
421422

Doc/whatsnew/3.12.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,11 @@ Removed
631631
<https://github.com/sphinx-contrib/sphinx-lint>`_.
632632
(Contributed by Julien Palard in :gh:`98179`.)
633633

634-
* Remove the *keyfile*, *certfile* and *check_hostname* parameters, deprecated
635-
since Python 3.6, in modules: :mod:`ftplib`, :mod:`http.client`,
636-
:mod:`imaplib`, :mod:`poplib` and :mod:`smtplib`. Use the *context* parameter
634+
* Remove the *keyfile* and *certfile* parameters from the
635+
:mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules,
636+
and the *key_file*, *cert_file* and *check_hostname* parameters from the
637+
:mod:`http.client` module,
638+
all deprecated since Python 3.6. Use the *context* parameter
637639
(*ssl_context* in :mod:`imaplib`) instead.
638640
(Contributed by Victor Stinner in :gh:`94172`.)
639641

Misc/NEWS.d/3.12.0a2.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -725,9 +725,11 @@ Fix handling of ``bytes`` :term:`path-like objects <path-like object>` in
725725
.. nonce: AXE2IZ
726726
.. section: Library
727727
728-
Remove the *keyfile*, *certfile* and *check_hostname* parameters, deprecated
729-
since Python 3.6, in modules: :mod:`ftplib`, :mod:`http.client`,
730-
:mod:`imaplib`, :mod:`poplib` and :mod:`smtplib`. Use the *context*
728+
Remove the *keyfile* and *certfile* parameters from the
729+
:mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules,
730+
and the *key_file*, *cert_file* and *check_hostname* parameters from the
731+
:mod:`http.client` module,
732+
all deprecated since Python 3.6. Use the *context*
731733
parameter (*ssl_context* in :mod:`imaplib`) instead. Patch by Victor
732734
Stinner.
733735

0 commit comments

Comments
 (0)