Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Next Next commit
gh-128646: Implement GzipFile.readinto() functions
  • Loading branch information
effigies committed Jan 8, 2025
commit 2ac657d26b13cbf2b1d49355df2ce3f74ebb0db3
14 changes: 14 additions & 0 deletions Lib/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,20 @@ def read1(self, size=-1):
size = io.DEFAULT_BUFFER_SIZE
return self._buffer.read1(size)

def readinto(self, b):
self._check_not_closed()
Comment thread
effigies marked this conversation as resolved.
if self.mode != READ:
import errno
raise OSError(errno.EBADF, "readinto() on write-only GzipFile object")
return self._buffer.readinto(b)

def readinto1(self, b):
self._check_not_closed()
if self.mode != READ:
import errno
raise OSError(errno.EBADF, "readinto1() on write-only GzipFile object")
return self._buffer.readinto1(b)

def peek(self, n):
self._check_not_closed()
if self.mode != READ:
Expand Down