py/mpconfig.h: Enable MICROPY_MODULE_GETATTR by default.

To enable lazy loading of submodules (among other things), which is very
useful for MicroPython libraries that want to have optional subcomponents.

Disabled explicitly on minimal ports.
This commit is contained in:
Damien George 2020-03-01 00:06:15 +11:00
parent c5cc64175b
commit f8fc78691d
3 changed files with 3 additions and 1 deletions

View File

@ -43,6 +43,7 @@
#define MICROPY_PY_STRUCT (0) #define MICROPY_PY_STRUCT (0)
#define MICROPY_PY_SYS (0) #define MICROPY_PY_SYS (0)
#define MICROPY_CPYTHON_COMPAT (0) #define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_MODULE_GETATTR (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
#define MICROPY_USE_INTERNAL_PRINTF (0) #define MICROPY_USE_INTERNAL_PRINTF (0)

View File

@ -55,6 +55,7 @@
#define MICROPY_PY_SYS (0) #define MICROPY_PY_SYS (0)
#define MICROPY_MODULE_FROZEN_MPY (1) #define MICROPY_MODULE_FROZEN_MPY (1)
#define MICROPY_CPYTHON_COMPAT (0) #define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_MODULE_GETATTR (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)

View File

@ -729,7 +729,7 @@ typedef double mp_float_t;
// Whether to support module-level __getattr__ (see PEP 562) // Whether to support module-level __getattr__ (see PEP 562)
#ifndef MICROPY_MODULE_GETATTR #ifndef MICROPY_MODULE_GETATTR
#define MICROPY_MODULE_GETATTR (0) #define MICROPY_MODULE_GETATTR (1)
#endif #endif
// Whether module weak links are supported // Whether module weak links are supported