summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorPaul m. p. P <paul.peny@wanadoo.fr>2018-10-22 18:34:29 +0200
committerDamien George <damien.p.george@gmail.com>2018-10-23 11:22:50 +1100
commit454cca6016afc96deb6d1ad5d1b3553ab9ad18dd (patch)
tree953cb4bdd6de7b25498d2e35e831c2b307a1b496 /py/mpconfig.h
parenta5273133829ed3e2a8c8e3c44e37e198e109f340 (diff)
py/objmodule: Implement PEP 562's __getattr__ for modules.
Configurable via MICROPY_MODULE_GETATTR, disabled by default. Among other things __getattr__ for modules can help to build lazy loading / code unloading at runtime.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 2e1efe7d5..10a373ce8 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -633,6 +633,11 @@ typedef double mp_float_t;
#define MICROPY_MODULE_BUILTIN_INIT (0)
#endif
+// Whether to support module-level __getattr__ (see PEP 562)
+#ifndef MICROPY_MODULE_GETATTR
+#define MICROPY_MODULE_GETATTR (0)
+#endif
+
// Whether module weak links are supported
#ifndef MICROPY_MODULE_WEAK_LINKS
#define MICROPY_MODULE_WEAK_LINKS (0)