From f8fc78691d4ee401184a62b7974ebdc8f16850ab Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 1 Mar 2020 00:06:15 +1100 Subject: [PATCH] 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. --- ports/bare-arm/mpconfigport.h | 1 + ports/minimal/mpconfigport.h | 1 + py/mpconfig.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/bare-arm/mpconfigport.h b/ports/bare-arm/mpconfigport.h index 273e21451b..4567676580 100644 --- a/ports/bare-arm/mpconfigport.h +++ b/ports/bare-arm/mpconfigport.h @@ -43,6 +43,7 @@ #define MICROPY_PY_STRUCT (0) #define MICROPY_PY_SYS (0) #define MICROPY_CPYTHON_COMPAT (0) +#define MICROPY_MODULE_GETATTR (0) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE) #define MICROPY_USE_INTERNAL_PRINTF (0) diff --git a/ports/minimal/mpconfigport.h b/ports/minimal/mpconfigport.h index 41e22cd010..2507d0124d 100644 --- a/ports/minimal/mpconfigport.h +++ b/ports/minimal/mpconfigport.h @@ -55,6 +55,7 @@ #define MICROPY_PY_SYS (0) #define MICROPY_MODULE_FROZEN_MPY (1) #define MICROPY_CPYTHON_COMPAT (0) +#define MICROPY_MODULE_GETATTR (0) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE) diff --git a/py/mpconfig.h b/py/mpconfig.h index 371f2ce036..c5829a3e09 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -729,7 +729,7 @@ typedef double mp_float_t; // Whether to support module-level __getattr__ (see PEP 562) #ifndef MICROPY_MODULE_GETATTR -#define MICROPY_MODULE_GETATTR (0) +#define MICROPY_MODULE_GETATTR (1) #endif // Whether module weak links are supported