Commit decd5972 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix io.FileIO: Add iteration support.

A file cannot be iterated concurrently, so we make io.FileIO its own
iterator.
parent d54bef76
f = open("io/data/file1")
for l in f:
print(l)
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment