Skip to content
4 changes: 2 additions & 2 deletions Lib/_pyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2458,6 +2458,8 @@ def detach(self):
return buffer

def seek(self, cookie, whence=0):
self._checkClosed()

def _reset_encoder(position):
"""Reset the encoder (merely useful for proper BOM handling)"""
try:
Expand All @@ -2471,8 +2473,6 @@ def _reset_encoder(position):
else:
encoder.reset()

if self.closed:
raise ValueError("tell on closed file")
if not self._seekable:
raise UnsupportedOperation("underlying stream is not seekable")
if whence == SEEK_CUR:
Expand Down
Loading