summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorMilan Rossa <rossa.milan@gmail.com>2019-08-14 16:09:36 +0200
committerDamien George <damien.p.george@gmail.com>2019-08-30 16:44:12 +1000
commit310b3d1b81d561e19d719acd89ee47b759e3795c (patch)
tree18beb2d50b30dd525fc57efd43a7e705e777fade /py/mpconfig.h
parentc96aedad4691d864c073890a7a20abc7ebd2de27 (diff)
py: Integrate sys.settrace feature into the VM and runtime.
This commit adds support for sys.settrace, allowing to install Python handlers to trace execution of Python code. The interface follows CPython as closely as possible. The feature is disabled by default and can be enabled via MICROPY_PY_SYS_SETTRACE.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 57dec3cf2..64dadde92 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -1171,6 +1171,11 @@ typedef double mp_float_t;
#define MICROPY_PY_SYS_ATEXIT (0)
#endif
+// Whether to provide "sys.settrace" function
+#ifndef MICROPY_PY_SYS_SETTRACE
+#define MICROPY_PY_SYS_SETTRACE (0)
+#endif
+
// Whether to provide "sys.getsizeof" function
#ifndef MICROPY_PY_SYS_GETSIZEOF
#define MICROPY_PY_SYS_GETSIZEOF (0)
@@ -1571,4 +1576,14 @@ 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