Skip to content

Commit

Permalink
Fix a few warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Jan 19, 2024
1 parent 1077f9b commit dc5013c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/xopen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ def close(self) -> None:
super().close()
if not hasattr(self, "process"):
# Exception was raised during __init__
if hasattr(self, "_stderr"):
self._stderr.close()
return
if "r" not in self._mode:
self._file.close()
Expand Down Expand Up @@ -381,6 +383,8 @@ def _raise_if_error(
raise OSError("{!r} (exit code {})".format(stderr_message, retcode))

def _read_error_message(self):
if self._stderr.closed:
return b""
self._stderr.flush()
self._stderr.seek(0)
return self._stderr.read()
Expand Down

0 comments on commit dc5013c

Please sign in to comment.