diff options
author | Damien George <damien.p.george@gmail.com> | 2017-04-01 23:52:24 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-11-20 16:18:50 +1100 |
commit | da154fdaf933e6546ae4d6888af1a79a76d71b4c (patch) | |
tree | 6c6bf68ed883075b502e3d71a2a006c7731469e4 /py/mpconfig.h | |
parent | 811ddcc65f9fb666228a9477139f4fceb31240dd (diff) |
py: Add config option to disable multiple inheritance.
This patch introduces a new compile-time config option to disable multiple
inheritance at the Python level: MICROPY_MULTIPLE_INHERITANCE. It is
enabled by default.
Disabling multiple inheritance eliminates a lot of recursion in the call
graph (which is important for some embedded systems), and can be used to
reduce code size for ports that are really constrained (by around 200 bytes
for Thumb2 archs).
With multiple inheritance disabled all tests in the test-suite pass except
those that explicitly test for multiple inheritance.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r-- | py/mpconfig.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 4209b32c6..095b7ef7b 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -666,6 +666,13 @@ typedef double mp_float_t; /*****************************************************************************/ /* Fine control over Python builtins, classes, modules, etc */ +// Whether to support multiple inheritance of Python classes. Multiple +// inheritance makes some C functions inherently recursive, and adds a bit of +// code overhead. +#ifndef MICROPY_MULTIPLE_INHERITANCE +#define MICROPY_MULTIPLE_INHERITANCE (1) +#endif + // Whether to implement attributes on functions #ifndef MICROPY_PY_FUNCTION_ATTRS #define MICROPY_PY_FUNCTION_ATTRS (0) |