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
a468adc7
Commit
a468adc7
authored
Sep 14, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9853: Fix the signature of SSLSocket.recvfrom() and
SSLSocket.sendto() to match the corresponding socket methods.
parent
9bfc0f09
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
Lib/ssl.py
Lib/ssl.py
+6
-4
Lib/test/test_ssl.py
Lib/test/test_ssl.py
+12
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ssl.py
View file @
a468adc7
...
...
@@ -258,13 +258,15 @@ class SSLSocket(socket):
else
:
return
socket
.
send
(
self
,
data
,
flags
)
def
sendto
(
self
,
data
,
addr
,
flags
=
0
):
def
sendto
(
self
,
data
,
flags_or_addr
,
addr
=
None
):
self
.
_checkClosed
()
if
self
.
_sslobj
:
raise
ValueError
(
"sendto not allowed on instances of %s"
%
self
.
__class__
)
elif
addr
is
None
:
return
socket
.
sendto
(
self
,
data
,
flags_or_addr
)
else
:
return
socket
.
sendto
(
self
,
data
,
addr
,
flags
)
return
socket
.
sendto
(
self
,
data
,
flags_or_addr
,
addr
)
def
sendall
(
self
,
data
,
flags
=
0
):
self
.
_checkClosed
()
...
...
@@ -308,13 +310,13 @@ class SSLSocket(socket):
else
:
return
socket
.
recv_into
(
self
,
buffer
,
nbytes
,
flags
)
def
recvfrom
(
self
,
addr
,
buflen
=
1024
,
flags
=
0
):
def
recvfrom
(
self
,
buflen
=
1024
,
flags
=
0
):
self
.
_checkClosed
()
if
self
.
_sslobj
:
raise
ValueError
(
"recvfrom not allowed on instances of %s"
%
self
.
__class__
)
else
:
return
socket
.
recvfrom
(
self
,
addr
,
buflen
,
flags
)
return
socket
.
recvfrom
(
self
,
buflen
,
flags
)
def
recvfrom_into
(
self
,
buffer
,
nbytes
=
None
,
flags
=
0
):
self
.
_checkClosed
()
...
...
Lib/test/test_ssl.py
View file @
a468adc7
...
...
@@ -163,6 +163,18 @@ class BasicSocketTests(unittest.TestCase):
del
ss
self
.
assertEqual
(
wr
(),
None
)
def
test_wrapped_unconnected
(
self
):
# Methods on an unconnected SSLSocket propagate the original
# socket.error raise by the underlying socket object.
s
=
socket
.
socket
(
socket
.
AF_INET
)
ss
=
ssl
.
wrap_socket
(
s
)
self
.
assertRaises
(
socket
.
error
,
ss
.
recv
,
1
)
self
.
assertRaises
(
socket
.
error
,
ss
.
recv_into
,
bytearray
(
b'x'
))
self
.
assertRaises
(
socket
.
error
,
ss
.
recvfrom
,
1
)
self
.
assertRaises
(
socket
.
error
,
ss
.
recvfrom_into
,
bytearray
(
b'x'
),
1
)
self
.
assertRaises
(
socket
.
error
,
ss
.
send
,
b'x'
)
self
.
assertRaises
(
socket
.
error
,
ss
.
sendto
,
b'x'
,
(
'0.0.0.0'
,
0
))
def
test_timeout
(
self
):
# Issue #8524: when creating an SSL socket, the timeout of the
# original socket should be retained.
...
...
Misc/NEWS
View file @
a468adc7
...
...
@@ -52,6 +52,9 @@ Core and Builtins
Library
-------
- Issue #9853: Fix the signature of SSLSocket.recvfrom() and
SSLSocket.sendto() to match the corresponding socket methods.
- Issue 9840: Added a decorator to reprlib for wrapping __repr__ methods
to make them handle recursive calls within the same thread.
...
...
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