File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,21 +159,18 @@ def _check_not_closed(self):
159159 raise ValueError ("I/O operation on closed file" )
160160
161161 def _check_can_read (self ):
162- if self .closed :
163- raise ValueError ("I/O operation on closed file" )
164162 if self ._mode not in (_MODE_READ , _MODE_READ_EOF ):
163+ self ._check_not_closed ()
165164 raise io .UnsupportedOperation ("File not open for reading" )
166165
167166 def _check_can_write (self ):
168- if self .closed :
169- raise ValueError ("I/O operation on closed file" )
170167 if self ._mode != _MODE_WRITE :
168+ self ._check_not_closed ()
171169 raise io .UnsupportedOperation ("File not open for writing" )
172170
173171 def _check_can_seek (self ):
174- if self .closed :
175- raise ValueError ("I/O operation on closed file" )
176172 if self ._mode not in (_MODE_READ , _MODE_READ_EOF ):
173+ self ._check_not_closed ()
177174 raise io .UnsupportedOperation ("Seeking is only supported "
178175 "on files open for reading" )
179176 if not self ._fp .seekable ():
You can’t perform that action at this time.
0 commit comments