File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ mp_obj_t mp_stream_unbuffered_iter(mp_obj_t self) {
382382
383383STATIC mp_obj_t stream_seek (mp_uint_t n_args , const mp_obj_t * args ) {
384384 struct _mp_obj_base_t * o = (struct _mp_obj_base_t * )args [0 ];
385- if (o -> type -> stream_p == NULL || o -> type -> stream_p -> read == NULL ) {
385+ if (o -> type -> stream_p == NULL || o -> type -> stream_p -> ioctl == NULL ) {
386386 // CPython: io.UnsupportedOperation, OSError subclass
387387 nlr_raise (mp_obj_new_exception_msg (& mp_type_OSError , "Operation not supported" ));
388388 }
Original file line number Diff line number Diff line change @@ -260,6 +260,7 @@ const mp_obj_type_t mp_type_fileio = {
260260STATIC const mp_stream_p_t textio_stream_p = {
261261 .read = file_obj_read ,
262262 .write = file_obj_write ,
263+ .ioctl = file_obj_ioctl ,
263264 .is_text = true,
264265};
265266
Original file line number Diff line number Diff line change 1010
1111print (f .seek (0 , 0 ))
1212print (f .read (5 ))
13+
14+ f .close ()
15+
16+ # test text mode
17+ f = open ("io/data/file1" , "rt" )
18+ print (f .seek (6 ))
19+ print (f .read (5 ))
20+ f .close ()
Original file line number Diff line number Diff line change @@ -240,6 +240,7 @@ const mp_obj_type_t mp_type_fileio = {
240240STATIC const mp_stream_p_t textio_stream_p = {
241241 .read = fdfile_read ,
242242 .write = fdfile_write ,
243+ .ioctl = fdfile_ioctl ,
243244 .is_text = true,
244245};
245246
You can’t perform that action at this time.
0 commit comments