diff options
author | Damien George <damien.p.george@gmail.com> | 2015-06-03 22:19:41 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-06-03 22:19:41 +0100 |
commit | 953c23b1bcc732ccb3a6e4798add9b1f2fc0f444 (patch) | |
tree | 0bfe1d249635ca6ef2b7b0e3060bab3cbcd76c09 | |
parent | 181adc6a4eb7e701a7604a8fbfa8830b99eb3e9f (diff) | |
download | micropython-953c23b1bcc732ccb3a6e4798add9b1f2fc0f444.tar.gz micropython-953c23b1bcc732ccb3a6e4798add9b1f2fc0f444.zip |
py: Add stack check to mp_iternext, since it can be called recursively.
Eg, builtin map can map over a map, etc, and call iternext deeply.
Addresses issue #1294.
-rw-r--r-- | py/runtime.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c index 4f2d5a1600..886146fa87 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1044,6 +1044,7 @@ mp_obj_t mp_iternext_allow_raise(mp_obj_t o_in) { // will always return MP_OBJ_STOP_ITERATION instead of raising StopIteration() (or any subclass thereof) // may raise other exceptions mp_obj_t mp_iternext(mp_obj_t o_in) { + MP_STACK_CHECK(); // enumerate, filter, map and zip can recursively call mp_iternext mp_obj_type_t *type = mp_obj_get_type(o_in); if (type->iternext != NULL) { return type->iternext(o_in); |