File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -367,8 +367,10 @@ def peek(self, n):
367367 if self .fileobj is None :
368368 return b''
369369 try :
370- # 1024 is the same buffering heuristic used in read()
371- self ._read (max (n , 1024 ))
370+ # Ensure that we don't return b"" if we haven't reached EOF.
371+ while self .extrasize == 0 :
372+ # 1024 is the same buffering heuristic used in read()
373+ self ._read (max (n , 1024 ))
372374 except EOFError :
373375 pass
374376 offset = self .offset - self .extrastart
Original file line number Diff line number Diff line change @@ -466,6 +466,9 @@ Library
466466- Issue #15424: Add a __sizeof__ implementation for array objects.
467467 Patch by Ludwig Hähne.
468468
469+ - Issue #15546: Fix handling of pathological input data in the peek() method
470+ of the GzipFile class.
471+
469472- Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog
470473 ended with '\'. Patch by Roger Serwy.
471474
You can’t perform that action at this time.
0 commit comments