You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
unix io.FileIO: Add iteration support.
A file cannot be iterated concurrently, so we make io.FileIO its own iterator.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
f = open("io/data/file1")
|
||||
for l in f:
|
||||
print(l)
|
||||
+2
-2
@@ -102,8 +102,8 @@ static const mp_obj_type_t rawfile_type = {
|
||||
"io.FileIO",
|
||||
.print = fdfile_print,
|
||||
.make_new = fdfile_make_new,
|
||||
.getiter = NULL,
|
||||
.iternext = NULL,
|
||||
.getiter = mp_identity,
|
||||
.iternext = mp_stream_unbuffered_iter,
|
||||
.stream_p = {
|
||||
.read = fdfile_read,
|
||||
.write = fdfile_write,
|
||||
|
||||
Reference in New Issue
Block a user