Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
dfb299bb
Commit
dfb299bb
authored
Apr 23, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #7943: Fix circular reference created when instantiating an SSL
socket. Initial patch by Péter Szabó.
parent
1273566c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
8 deletions
+24
-8
Lib/ssl.py
Lib/ssl.py
+9
-8
Lib/test/test_ssl.py
Lib/test/test_ssl.py
+11
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ssl.py
View file @
dfb299bb
...
@@ -75,7 +75,7 @@ from _ssl import \
...
@@ -75,7 +75,7 @@ from _ssl import \
SSL_ERROR_EOF
,
\
SSL_ERROR_EOF
,
\
SSL_ERROR_INVALID_ERROR_CODE
SSL_ERROR_INVALID_ERROR_CODE
from
socket
import
socket
,
_fileobject
,
error
as
socket_error
from
socket
import
socket
,
_fileobject
,
_delegate_methods
,
error
as
socket_error
from
socket
import
getnameinfo
as
_getnameinfo
from
socket
import
getnameinfo
as
_getnameinfo
import
base64
# for DER-to-PEM translation
import
base64
# for DER-to-PEM translation
...
@@ -91,13 +91,14 @@ class SSLSocket(socket):
...
@@ -91,13 +91,14 @@ class SSLSocket(socket):
do_handshake_on_connect
=
True
,
do_handshake_on_connect
=
True
,
suppress_ragged_eofs
=
True
,
ciphers
=
None
):
suppress_ragged_eofs
=
True
,
ciphers
=
None
):
socket
.
__init__
(
self
,
_sock
=
sock
.
_sock
)
socket
.
__init__
(
self
,
_sock
=
sock
.
_sock
)
# the initializer for socket trashes the methods (tsk, tsk), so...
# The initializer for socket overrides the methods send(), recv(), etc.
self
.
send
=
lambda
data
,
flags
=
0
:
SSLSocket
.
send
(
self
,
data
,
flags
)
# in the instancce, which we don't need -- but we want to provide the
self
.
sendto
=
lambda
data
,
addr
,
flags
=
0
:
SSLSocket
.
sendto
(
self
,
data
,
addr
,
flags
)
# methods defined in SSLSocket.
self
.
recv
=
lambda
buflen
=
1024
,
flags
=
0
:
SSLSocket
.
recv
(
self
,
buflen
,
flags
)
for
attr
in
_delegate_methods
:
self
.
recvfrom
=
lambda
addr
,
buflen
=
1024
,
flags
=
0
:
SSLSocket
.
recvfrom
(
self
,
addr
,
buflen
,
flags
)
try
:
self
.
recv_into
=
lambda
buffer
,
nbytes
=
None
,
flags
=
0
:
SSLSocket
.
recv_into
(
self
,
buffer
,
nbytes
,
flags
)
delattr
(
self
,
attr
)
self
.
recvfrom_into
=
lambda
buffer
,
nbytes
=
None
,
flags
=
0
:
SSLSocket
.
recvfrom_into
(
self
,
buffer
,
nbytes
,
flags
)
except
AttributeError
:
pass
if
certfile
and
not
keyfile
:
if
certfile
and
not
keyfile
:
keyfile
=
certfile
keyfile
=
certfile
...
...
Lib/test/test_ssl.py
View file @
dfb299bb
...
@@ -11,6 +11,7 @@ import os
...
@@ -11,6 +11,7 @@ import os
import
pprint
import
pprint
import
urllib
,
urlparse
import
urllib
,
urlparse
import
traceback
import
traceback
import
weakref
from
BaseHTTPServer
import
HTTPServer
from
BaseHTTPServer
import
HTTPServer
from
SimpleHTTPServer
import
SimpleHTTPRequestHandler
from
SimpleHTTPServer
import
SimpleHTTPRequestHandler
...
@@ -154,6 +155,16 @@ class BasicTests(unittest.TestCase):
...
@@ -154,6 +155,16 @@ class BasicTests(unittest.TestCase):
with
self
.
assertRaisesRegexp
(
ssl
.
SSLError
,
"No cipher can be selected"
):
with
self
.
assertRaisesRegexp
(
ssl
.
SSLError
,
"No cipher can be selected"
):
s
.
connect
(
remote
)
s
.
connect
(
remote
)
@
test_support
.
cpython_only
def
test_refcycle
(
self
):
# Issue #7943: an SSL object doesn't create reference cycles with
# itself.
s
=
socket
.
socket
(
socket
.
AF_INET
)
ss
=
ssl
.
wrap_socket
(
s
)
wr
=
weakref
.
ref
(
ss
)
del
ss
self
.
assertEqual
(
wr
(),
None
)
class
NetworkedTests
(
unittest
.
TestCase
):
class
NetworkedTests
(
unittest
.
TestCase
):
...
...
Misc/ACKS
View file @
dfb299bb
...
@@ -743,6 +743,7 @@ Andrew Svetlov
...
@@ -743,6 +743,7 @@ Andrew Svetlov
Kalle Svensson
Kalle Svensson
Paul Swartz
Paul Swartz
Thenault Sylvain
Thenault Sylvain
Péter Szabó
Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis
Geoff Talvola
Geoff Talvola
William Tanksley
William Tanksley
...
...
Misc/NEWS
View file @
dfb299bb
...
@@ -25,6 +25,9 @@ Core and Builtins
...
@@ -25,6 +25,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #7943: Fix circular reference created when instantiating an SSL
socket. Initial patch by Péter Szabó.
- Issue #8451: Syslog module now uses basename(sys.argv[0]) instead of
- Issue #8451: Syslog module now uses basename(sys.argv[0]) instead of
the string "python" as the *ident*. openlog() arguments are all optional
the string "python" as the *ident*. openlog() arguments are all optional
and keywords.
and keywords.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment