diff options
| author | Damien George <damien.p.george@gmail.com> | 2016-01-09 23:14:54 +0000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2017-02-16 18:38:06 +1100 |
| commit | ae8d86758631e62466a55d179897d2111c3cb1c1 (patch) | |
| tree | 1852733b57cd4334727203e11d5af76243615636 /py/runtime.h | |
| parent | 101886f5291fdbef07ba70d386c5e3e644b71cfb (diff) | |
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 'py/runtime.h')
| -rw-r--r-- | py/runtime.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/runtime.h b/py/runtime.h index e25f2a483..954833b67 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -123,7 +123,7 @@ void mp_load_method(mp_obj_t base, qstr attr, mp_obj_t *dest); void mp_load_method_maybe(mp_obj_t base, qstr attr, mp_obj_t *dest); void mp_store_attr(mp_obj_t base, qstr attr, mp_obj_t val); -mp_obj_t mp_getiter(mp_obj_t o); +mp_obj_t mp_getiter(mp_obj_t o, mp_obj_iter_buf_t *iter_buf); mp_obj_t mp_iternext_allow_raise(mp_obj_t o); // may return MP_OBJ_STOP_ITERATION instead of raising StopIteration() mp_obj_t mp_iternext(mp_obj_t o); // will always return MP_OBJ_STOP_ITERATION instead of raising StopIteration(...) mp_vm_return_kind_t mp_resume(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, mp_obj_t *ret_val); |
