mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
GH-91355: micro-optimize Connection.send_bytes() method (gh-32247)
This commit is contained in:
parent
9dc4aae8e9
commit
1699128c48
1 changed files with 2 additions and 3 deletions
|
|
@ -188,10 +188,9 @@ class _ConnectionBase:
|
|||
self._check_closed()
|
||||
self._check_writable()
|
||||
m = memoryview(buf)
|
||||
# HACK for byte-indexing of non-bytewise buffers (e.g. array.array)
|
||||
if m.itemsize > 1:
|
||||
m = memoryview(bytes(m))
|
||||
n = len(m)
|
||||
m = m.cast('B')
|
||||
n = m.nbytes
|
||||
if offset < 0:
|
||||
raise ValueError("offset is negative")
|
||||
if n < offset:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue