Skip to content

Commit

Permalink
Merge pull request astropy#15361 from meeseeksmachine/auto-backport-o…
Browse files Browse the repository at this point in the history
…f-pr-15359-on-v5.3.x

Backport PR astropy#15359 on branch v5.3.x (BUG: Close Gzipfile in votable/utils properly)
  • Loading branch information
pllim committed Sep 21, 2023
2 parents d4b0ede + 9753746 commit 5753610
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/15359.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 5753610

Please sign in to comment.