mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] gh-84443: SSLSocket.recv_into() now support buffer protocol with itemsize != 1 (GH-20310) (GH-112459)
It is also no longer use __len__().
(cherry picked from commit 812360fddd
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
parent
62e430af9e
commit
6d9b1819b8
3 changed files with 32 additions and 4 deletions
12
Lib/ssl.py
12
Lib/ssl.py
|
@ -1299,10 +1299,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