summaryrefslogtreecommitdiffstats
path: root/Lib/poplib.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-03 17:32:25 (GMT)
committerGitHub <noreply@github.com>2022-11-03 17:32:25 (GMT)
commitef0e72b31d22f780d3a165d7d0471806061fe380 (patch)
treeb6c37400400dbca49c00466290a60122b6137ae9 /Lib/poplib.py
parent9c4ae037b9c39312b792964497c090ce01570208 (diff)
downloadcpython-ef0e72b31d22f780d3a165d7d0471806061fe380.zip
cpython-ef0e72b31d22f780d3a165d7d0471806061fe380.tar.gz
cpython-ef0e72b31d22f780d3a165d7d0471806061fe380.tar.bz2
gh-94172: Remove keyfile, certfile and check_hostname parameters (#94173)
Remove the keyfile, certfile and check_hostname parameters, deprecated since Python 3.6, in modules: ftplib, http.client, imaplib, poplib and smtplib. Use the context parameter (ssl_context in imaplib) instead. Parameters following the removed parameters become keyword-only parameters. ftplib: Remove the FTP_TLS.ssl_version class attribute: use the context parameter instead.
Diffstat (limited to 'Lib/poplib.py')
-rw-r--r--Lib/poplib.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/Lib/poplib.py b/Lib/poplib.py
index 0f85873..9a5ef03 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -419,35 +419,19 @@ if HAVE_SSL:
class POP3_SSL(POP3):
"""POP3 client class over SSL connection
- Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None,
- context=None)
+ Instantiate with: POP3_SSL(hostname, port=995, context=None)
hostname - the hostname of the pop3 over ssl server
port - port number
- keyfile - PEM formatted file that contains your private key
- certfile - PEM formatted certificate chain file
context - a ssl.SSLContext
See the methods of the parent class POP3 for more documentation.
"""
- def __init__(self, host, port=POP3_SSL_PORT, keyfile=None, certfile=None,
- timeout=socket._GLOBAL_DEFAULT_TIMEOUT, context=None):
- if context is not None and keyfile is not None:
- raise ValueError("context and keyfile arguments are mutually "
- "exclusive")
- if context is not None and certfile is not None:
- raise ValueError("context and certfile arguments are mutually "
- "exclusive")
- if keyfile is not None or certfile is not None:
- import warnings
- warnings.warn("keyfile and certfile are deprecated, use a "
- "custom context instead", DeprecationWarning, 2)
- self.keyfile = keyfile
- self.certfile = certfile
+ def __init__(self, host, port=POP3_SSL_PORT,
+ *, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, context=None):
if context is None:
- context = ssl._create_stdlib_context(certfile=certfile,
- keyfile=keyfile)
+ context = ssl._create_stdlib_context()
self.context = context
POP3.__init__(self, host, port, timeout)
@@ -457,7 +441,7 @@ if HAVE_SSL:
server_hostname=self.host)
return sock
- def stls(self, keyfile=None, certfile=None, context=None):
+ def stls(self, context=None):
"""The method unconditionally raises an exception since the
STLS command doesn't make any sense on an already established
SSL/TLS session.