mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Issue #28022: Deprecate ssl-related arguments in favor of SSLContext.
The deprecation include manual creation of SSLSocket and certfile/keyfile (or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib. ssl.wrap_socket() is not marked as deprecated yet.
This commit is contained in:
parent
130bbe5fd3
commit
d04863771b
23 changed files with 189 additions and 85 deletions
|
@ -759,6 +759,10 @@ class SMTP:
|
|||
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)
|
||||
if context is None:
|
||||
context = ssl._create_stdlib_context(certfile=certfile,
|
||||
keyfile=keyfile)
|
||||
|
@ -1011,6 +1015,10 @@ if _have_ssl:
|
|||
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
|
||||
if context is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue