py: Add MICROPY_PY_BUILTINS_ENUMERATE, disable for minimal ports.
This commit is contained in:
parent
96b60ed956
commit
e2d44e30c7
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user