Skip to content

Commit 266aa5a

Browse files
authored
Update _pyio.py
1 parent f402966 commit 266aa5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/_pyio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,6 +2458,8 @@ def detach(self):
24582458
return buffer
24592459

24602460
def seek(self, cookie, whence=0):
2461+
self._checkClosed()
2462+
24612463
def _reset_encoder(position):
24622464
"""Reset the encoder (merely useful for proper BOM handling)"""
24632465
try:
@@ -2471,8 +2473,6 @@ def _reset_encoder(position):
24712473
else:
24722474
encoder.reset()
24732475

2474-
if self.closed:
2475-
raise ValueError("seek on closed file")
24762476
if not self._seekable:
24772477
raise UnsupportedOperation("underlying stream is not seekable")
24782478
if whence == SEEK_CUR:

0 commit comments

Comments
 (0)