summaryrefslogtreecommitdiff
path: root/py/modsys.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-06-05 22:38:36 +1000
committerJim Mussared <jim.mussared@gmail.com>2023-06-08 17:54:24 +1000
commit7d2ee8aed0cc5ba1a0041ac4cc7631898aaf252f (patch)
tree5c1aab94307eb4cb8fab0274413a31862ec1248e /py/modsys.c
parente6926d60219d9b00da3eedb5eedecefe0d6c321c (diff)
py/mpconfig: Enable module delegation if sys needs it.
Otherwise you can get into the confusing state where e.g. sys.ps1 is enabled in config (via `MICROPY_PY_SYS_PS1_PS2`) but still doesn't actually get enabled. Also verify that the required delegation options are enabled in modsys.c. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'py/modsys.c')
-rw-r--r--py/modsys.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/py/modsys.c b/py/modsys.c
index a0ecb87b5..72817ce00 100644
--- a/py/modsys.c
+++ b/py/modsys.c
@@ -195,7 +195,21 @@ STATIC mp_obj_t mp_sys_settrace(mp_obj_t obj) {
MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace);
#endif // MICROPY_PY_SYS_SETTRACE
+
+#if MICROPY_PY_SYS_PS1_PS2 && !MICROPY_PY_SYS_ATTR_DELEGATION
+#error "MICROPY_PY_SYS_PS1_PS2 requires MICROPY_PY_SYS_ATTR_DELEGATION"
+#endif
+
+#if MICROPY_PY_SYS_TRACEBACKLIMIT && !MICROPY_PY_SYS_ATTR_DELEGATION
+#error "MICROPY_PY_SYS_TRACEBACKLIMIT requires MICROPY_PY_SYS_ATTR_DELEGATION"
+#endif
+
+#if MICROPY_PY_SYS_ATTR_DELEGATION && !MICROPY_MODULE_ATTR_DELEGATION
+#error "MICROPY_PY_SYS_ATTR_DELEGATION requires MICROPY_MODULE_ATTR_DELEGATION"
+#endif
+
#if MICROPY_PY_SYS_ATTR_DELEGATION
+// Must be kept in sync with the enum at the top of mpstate.h.
STATIC const uint16_t sys_mutable_keys[] = {
#if MICROPY_PY_SYS_PS1_PS2
MP_QSTR_ps1,