diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py index ac2332e58468a2..823d44e0465eba 100644 --- a/Lib/zipfile/__init__.py +++ b/Lib/zipfile/__init__.py @@ -743,7 +743,7 @@ def decrypter(data): c ^= ((k * (k^1)) >> 8) & 0xFF update_keys(c) append(c) - return bytes(result) + return result.take_bytes() return decrypter diff --git a/Misc/NEWS.d/next/Library/2025-12-03-12-46-32.gh-issue-141968.fO8Cte.rst b/Misc/NEWS.d/next/Library/2025-12-03-12-46-32.gh-issue-141968.fO8Cte.rst new file mode 100644 index 00000000000000..a12f49975d9860 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-03-12-46-32.gh-issue-141968.fO8Cte.rst @@ -0,0 +1,2 @@ +Remove data copy from :mod:`zipfile` decryption using +:meth:`bytearray.take_bytes`.