diff options
| author | Damien George <damien.p.george@gmail.com> | 2014-12-09 16:19:48 +0000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2014-12-09 16:19:48 +0000 |
| commit | 78d702c300ae9f175e6f47f805a37cdfe5b81898 (patch) | |
| tree | 034b42ea789dc38c629a2f0dd8a48001a32cd838 /py/mpconfig.h | |
| parent | e6e8ad8ab238cd596a3eedf8f4dd635e2e84f46e (diff) | |
py: Allow builtins to be overridden.
This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS)
which, when enabled, allows to override all names within the builtins
module. A builtins override dict is created the first time the user
assigns to a name in the builtins model, and then that dict is searched
first on subsequent lookups. Note that this implementation doesn't
allow deleting of names.
This patch also does some refactoring of builtins code, creating the
modbuiltins.c file.
Addresses issue #959.
Diffstat (limited to 'py/mpconfig.h')
| -rw-r--r-- | py/mpconfig.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 4bd7bfeab..880e46987 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -292,6 +292,11 @@ typedef double mp_float_t; #define MICROPY_MODULE_WEAK_LINKS (0) #endif +// Whether you can override builtins in the builtins module +#ifndef MICROPY_CAN_OVERRIDE_BUILTINS +#define MICROPY_CAN_OVERRIDE_BUILTINS (0) +#endif + /*****************************************************************************/ /* Fine control over Python builtins, classes, modules, etc */ |
