Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply suggestions from code review
Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
cmaloney and vstinner authored Mar 6, 2025
commit da8a02111bfb96775845199f855c2337290767fa
6 changes: 4 additions & 2 deletions Lib/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ def closed(self):

def close(self):
fileobj = self.fileobj
if fileobj is None or self._buffer is None or self._buffer.closed:
if fileobj is None:
return
if self._buffer is None or self._buffer.closed:
return
try:
if self.mode == WRITE:
Expand Down Expand Up @@ -446,7 +448,7 @@ def __del__(self):
warnings.warn("unclosed GzipFile",
ResourceWarning, source=self, stacklevel=2)

return super().__del__()
super().__del__()

def _read_exact(fp, n):
'''Read exactly *n* bytes from `fp`
Expand Down