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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Align ``_pyio.TextIOWrapper.seek``'s file closed check with its C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the technical details out of it. Could you say something about the error message?

implementation
Loading