Skip to content

Commit de7ef16

Browse files
authored
Merge pull request #555 from mjs/remove-py2-ssl-compat
Remove SSL compatibility code for Python 2
2 parents 5db7671 + 41e65f5 commit de7ef16

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

imapclient/tls.py

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015, Menno Smits
1+
# Copyright (c) 2023, Menno Smits
22
# Released subject to the New BSD License
33
# Please see http://en.wikipedia.org/wiki/BSD_licenses
44

@@ -20,18 +20,6 @@
2020
def wrap_socket(
2121
sock: socket.socket, ssl_context: Optional[ssl.SSLContext], host: str
2222
) -> socket.socket:
23-
if not hasattr(ssl, "create_default_context"):
24-
# Python 2.7.0 - 2.7.8 do not have the concept of ssl contexts.
25-
# Thus we have to use the less flexible and legacy way of wrapping the
26-
# socket
27-
if ssl_context is not None:
28-
raise RuntimeError(
29-
"Cannot precisely configure the SSL connection, upgrade to "
30-
"Python >= 2.7.9 to fine tune the settings."
31-
)
32-
33-
return ssl.wrap_socket(sock)
34-
3523
if ssl_context is None:
3624
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
3725

0 commit comments

Comments
 (0)