summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/vfs_fat_file.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-01-09 23:14:54 +0000
committerDamien George <damien.p.george@gmail.com>2017-02-16 18:38:06 +1100
commitae8d86758631e62466a55d179897d2111c3cb1c1 (patch)
tree1852733b57cd4334727203e11d5af76243615636 /extmod/vfs_fat_file.c
parent101886f5291fdbef07ba70d386c5e3e644b71cfb (diff)
downloadmicropython-ae8d86758631e62466a55d179897d2111c3cb1c1.tar.gz
micropython-ae8d86758631e62466a55d179897d2111c3cb1c1.zip
py: Add iter_buf to getiter type method.
Allows to iterate over the following without allocating on the heap: - tuple - list - string, bytes - bytearray, array - dict (not dict.keys, dict.values, dict.items) - set, frozenset Allows to call the following without heap memory: - all, any, min, max, sum TODO: still need to allocate stack memory in bytecode for iter_buf.
Diffstat (limited to 'extmod/vfs_fat_file.c')
-rw-r--r--extmod/vfs_fat_file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index 62da23f948..6263492cbd 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -264,7 +264,7 @@ const mp_obj_type_t mp_type_fileio = {
.name = MP_QSTR_FileIO,
.print = file_obj_print,
.make_new = file_obj_make_new,
- .getiter = mp_identity,
+ .getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &fileio_stream_p,
.locals_dict = (mp_obj_dict_t*)&rawfile_locals_dict,
@@ -283,7 +283,7 @@ const mp_obj_type_t mp_type_textio = {
.name = MP_QSTR_TextIOWrapper,
.print = file_obj_print,
.make_new = file_obj_make_new,
- .getiter = mp_identity,
+ .getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &textio_stream_p,
.locals_dict = (mp_obj_dict_t*)&rawfile_locals_dict,