Skip to content

Commit

Permalink
gh-128646: Implement GzipFile.readinto() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jan 8, 2025
1 parent 004f9fd commit 0530957
Showing 1 changed file with 14 additions and 0 deletions.
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()
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

0 comments on commit 0530957

Please sign in to comment.