mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
#15546: Also fix GzipFile.peek().
This commit is contained in:
parent
e3ded955f3
commit
043540088a
2 changed files with 6 additions and 4 deletions
|
@ -413,8 +413,10 @@ class GzipFile(io.BufferedIOBase):
|
|||
if self.fileobj is None:
|
||||
return b''
|
||||
try:
|
||||
# 1024 is the same buffering heuristic used in read()
|
||||
self._read(max(n, 1024))
|
||||
# Ensure that we don't return b"" if we haven't reached EOF.
|
||||
while self.extrasize == 0:
|
||||
# 1024 is the same buffering heuristic used in read()
|
||||
self._read(max(n, 1024))
|
||||
except EOFError:
|
||||
pass
|
||||
offset = self.offset - self.extrastart
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue