mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-84443: SSLSocket.recv_into() now support buffer protocol with itemsize != 1 (GH-20310)
It is also no longer use __len__(). Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
22e411e1d1
commit
812360fddd
3 changed files with 32 additions and 4 deletions
12
Lib/ssl.py
12
Lib/ssl.py
|
@ -1270,10 +1270,14 @@ class SSLSocket(socket):
|
|||
|
||||
def recv_into(self, buffer, nbytes=None, flags=0):
|
||||
self._checkClosed()
|
||||
if buffer and (nbytes is None):
|
||||
nbytes = len(buffer)
|
||||
elif nbytes is None:
|
||||
nbytes = 1024
|
||||
if nbytes is None:
|
||||
if buffer is not None:
|
||||
with memoryview(buffer) as view:
|
||||
nbytes = view.nbytes
|
||||
if not nbytes:
|
||||
nbytes = 1024
|
||||
else:
|
||||
nbytes = 1024
|
||||
if self._sslobj is not None:
|
||||
if flags != 0:
|
||||
raise ValueError(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue