summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/mpconfig.h16
-rw-r--r--py/profile.c6
2 files changed, 10 insertions, 12 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index de4a89206..46c62913c 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -312,9 +312,11 @@
#define MICROPY_PERSISTENT_CODE_LOAD (0)
#endif
-// Whether to support saving of persistent code
+// Whether to support saving of persistent code, i.e. for mpy-cross to
+// generate .mpy files. Enabling this enables additional metadata on raw code
+// objects which is also required for sys.settrace.
#ifndef MICROPY_PERSISTENT_CODE_SAVE
-#define MICROPY_PERSISTENT_CODE_SAVE (0)
+#define MICROPY_PERSISTENT_CODE_SAVE (MICROPY_PY_SYS_SETTRACE)
#endif
// Whether to support saving persistent code to a file via mp_raw_code_save_file
@@ -2013,14 +2015,4 @@ typedef double mp_float_t;
#define MP_WARN_CAT(x) (NULL)
#endif
-// Feature dependency check.
-#if MICROPY_PY_SYS_SETTRACE
-#if !MICROPY_PERSISTENT_CODE_SAVE
-#error "MICROPY_PY_SYS_SETTRACE requires MICROPY_PERSISTENT_CODE_SAVE to be enabled"
-#endif
-#if MICROPY_COMP_CONST
-#error "MICROPY_PY_SYS_SETTRACE requires MICROPY_COMP_CONST to be disabled"
-#endif
-#endif
-
#endif // MICROPY_INCLUDED_PY_MPCONFIG_H
diff --git a/py/profile.c b/py/profile.c
index 89af8640a..274089d70 100644
--- a/py/profile.c
+++ b/py/profile.c
@@ -31,6 +31,12 @@
#if MICROPY_PY_SYS_SETTRACE
+#if !MICROPY_PERSISTENT_CODE_SAVE
+// The settrace feature requires that we maintain additional metadata on the raw
+// code object which is normally only done when writing .mpy files.
+#error "MICROPY_PY_SYS_SETTRACE requires MICROPY_PERSISTENT_CODE_SAVE to be enabled"
+#endif
+
#define prof_trace_cb MP_STATE_THREAD(prof_trace_callback)
#define QSTR_MAP(context, idx) (context->constants.qstr_table[idx])