Skip to content

Commit e1d7ff7

Browse files
committed
gh-141968: Use take_byes in zipfile._ZipDecrypter
Removes a copy going from bytearray to bytes.
1 parent 62423c9 commit e1d7ff7

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/zipfile/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ def decrypter(data):
743743
c ^= ((k * (k^1)) >> 8) & 0xFF
744744
update_keys(c)
745745
append(c)
746-
return bytes(result)
746+
return result.take_bytes()
747747

748748
return decrypter
749749

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove data copy from :mod:`zipfile` decryption using
2+
:meth:`bytearray.take_bytes`.

0 commit comments

Comments
 (0)