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

py: Add MICROPY_PY_BUILTINS_ENUMERATE, disable for minimal ports.

parent 96b60ed9
......@@ -21,6 +21,7 @@
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FROZENSET (0)
#define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_SLICE (0)
......
......@@ -594,7 +594,9 @@ STATIC const mp_map_elem_t mp_module_builtins_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_complex), (mp_obj_t)&mp_type_complex },
#endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_dict), (mp_obj_t)&mp_type_dict },
#if MICROPY_PY_BUILTINS_ENUMERATE
{ MP_OBJ_NEW_QSTR(MP_QSTR_enumerate), (mp_obj_t)&mp_type_enumerate },
#endif
{ MP_OBJ_NEW_QSTR(MP_QSTR_filter), (mp_obj_t)&mp_type_filter },
#if MICROPY_PY_BUILTINS_FLOAT
{ MP_OBJ_NEW_QSTR(MP_QSTR_float), (mp_obj_t)&mp_type_float },
......
......@@ -459,6 +459,11 @@ typedef double mp_float_t;
#define MICROPY_PY_BUILTINS_COMPILE (0)
#endif
// Whether to support enumerate function(type)
#ifndef MICROPY_PY_BUILTINS_ENUMERATE
#define MICROPY_PY_BUILTINS_ENUMERATE (1)
#endif
// Whether to support the Python 2 execfile function
#ifndef MICROPY_PY_BUILTINS_EXECFILE
#define MICROPY_PY_BUILTINS_EXECFILE (0)
......
......@@ -29,6 +29,8 @@
#include "py/runtime.h"
#if MICROPY_PY_BUILTINS_ENUMERATE
typedef struct _mp_obj_enumerate_t {
mp_obj_base_t base;
mp_obj_t iter;
......@@ -83,3 +85,5 @@ STATIC mp_obj_t enumerate_iternext(mp_obj_t self_in) {
return mp_obj_new_tuple(2, items);
}
}
#endif // MICROPY_PY_BUILTINS_ENUMERATE
......@@ -48,6 +48,7 @@
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
#define MICROPY_PY_BUILTINS_COMPILE (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FROZENSET (0)
#define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_SLICE (0)
......
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