Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions imapclient/tls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015, Menno Smits
# Copyright (c) 2023, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses

Expand All @@ -20,18 +20,6 @@
def wrap_socket(
sock: socket.socket, ssl_context: Optional[ssl.SSLContext], host: str
) -> socket.socket:
if not hasattr(ssl, "create_default_context"):
# Python 2.7.0 - 2.7.8 do not have the concept of ssl contexts.
# Thus we have to use the less flexible and legacy way of wrapping the
# socket
if ssl_context is not None:
raise RuntimeError(
"Cannot precisely configure the SSL connection, upgrade to "
"Python >= 2.7.9 to fine tune the settings."
)

return ssl.wrap_socket(sock)

if ssl_context is None:
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)

Expand Down