Skip to content

Commit

Permalink
FIX: Hack around 3.12rc1 bug (python/cpython#108111)
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Sep 8, 2023
1 parent 06c1e76 commit eb39c08
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nibabel/openers.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def __init__(
mtime=mtime,
)

def seek(self, pos: int, whence: int = 0, /) -> int:
# Work around bug (gh-180111) in Python 3.12rc1, where seeking without
# flushing can cause write of excess null bytes
self.flush()
return super().seek(pos, whence)


def _gzip_open(
filename: str,
Expand Down

0 comments on commit eb39c08

Please sign in to comment.