Skip to content

Commit

Permalink
BUG: Close Gzipfile in votable/utils properly.
Browse files Browse the repository at this point in the history
Co-authored-by: Maximilian Linhoff <maximilian.linhoff@tu-dortmund.de>
  • Loading branch information
pllim and maxnoe committed Sep 20, 2023
1 parent 7993d5f commit 97b5c56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions astropy/io/votable/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ def convert_to_writable_filelike(fd, compressed=False):

if needs_wrapper:
yield codecs.getwriter("utf-8")(fd)
fd.flush()
else:
yield fd
fd.flush()

fd.flush()
if isinstance(fd, gzip.GzipFile):
fd.close()

return
else:
Expand Down
1 change: 1 addition & 0 deletions docs/changes/io.votable/15358.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug in ``convert_to_writable_filelike`` where ``GzipFile`` was not closed properly.

0 comments on commit 97b5c56

Please sign in to comment.