Skip to content

Commit a5d2b4c

Browse files
committed
Break SSL support out of _socket module and place it into a new
helper module _ssl. The support for the RAND_* APIs in _ssl is now only enabled for OpenSSL 0.9.5 and up since they were added in that release. Note that socketmodule.* should really be renamed to _socket.* -- unfortunately, this seems to lose the CVS history of the file. Please review and test... I was only able to test the header file chaos in socketmodule.c/h on Linux. The test run through fine and compiles don't give errors or warnings. WARNING: This patch does *not* include changes to the various non-Unix build process files.
1 parent e441860 commit a5d2b4c

7 files changed

Lines changed: 749 additions & 579 deletions

File tree

Lib/socket.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
"""
4040

4141
from _socket import *
42+
try:
43+
from _ssl import *
44+
except ImportError:
45+
pass
4246

4347
import os, sys
4448

@@ -56,7 +60,7 @@ def socket(family, type, proto=0):
5660
return _socketobject(_realsocketcall(family, type, proto))
5761

5862
try:
59-
_realsslcall = _socket.ssl
63+
_realsslcall = _ssl.ssl
6064
except AttributeError:
6165
pass # No ssl
6266
else:

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Extension modules
2121

2222
Library
2323

24+
- socket module: the SSL support was broken out of the main
25+
_socket module C helper and placed into a new _ssl helper
26+
which now gets imported by socket.py if available and working.
27+
2428
- encodings package: added aliases for all supported IANA character
2529
sets
2630

Modules/Setup.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ GLHACK=-Dclear=__GLclear
175175
# Dynamic readlines
176176
#xreadlines xreadlinesmodule.c
177177

178-
# for socket(2), without SSL support.
178+
# Socket module helper for socket(2)
179179
#_socket socketmodule.c
180180

181-
# Socket module compiled with SSL support; you must comment out the other
181+
# Socket module helper for SSL support; you must comment out the other
182182
# socket line above, and possibly edit the SSL variable:
183183
#SSL=/usr/local/ssl
184-
#_socket socketmodule.c \
184+
#_ssl _ssl.c \
185185
# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
186186
# -L$(SSL)/lib -lssl -lcrypto
187187

0 commit comments

Comments
 (0)