Skip to content

Commit 2ac657d

Browse files
committed
gh-128646: Implement GzipFile.readinto() functions
1 parent 34e840f commit 2ac657d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/gzip.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,20 @@ def read1(self, size=-1):
338338
size = io.DEFAULT_BUFFER_SIZE
339339
return self._buffer.read1(size)
340340

341+
def readinto(self, b):
342+
self._check_not_closed()
343+
if self.mode != READ:
344+
import errno
345+
raise OSError(errno.EBADF, "readinto() on write-only GzipFile object")
346+
return self._buffer.readinto(b)
347+
348+
def readinto1(self, b):
349+
self._check_not_closed()
350+
if self.mode != READ:
351+
import errno
352+
raise OSError(errno.EBADF, "readinto1() on write-only GzipFile object")
353+
return self._buffer.readinto1(b)
354+
341355
def peek(self, n):
342356
self._check_not_closed()
343357
if self.mode != READ:

0 commit comments

Comments
 (0)