From 78d702c300ae9f175e6f47f805a37cdfe5b81898 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 9 Dec 2014 16:19:48 +0000 Subject: 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. --- stmhal/mpconfigport.h | 1 + 1 file changed, 1 insertion(+) (limited to 'stmhal') diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index d730173b0..1b2cf4abf 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -50,6 +50,7 @@ #define MICROPY_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */ #define MICROPY_STREAMS_NON_BLOCK (1) #define MICROPY_MODULE_WEAK_LINKS (1) +#define MICROPY_CAN_OVERRIDE_BUILTINS (1) #define MICROPY_PY_BUILTINS_STR_UNICODE (1) #define MICROPY_PY_BUILTINS_MEMORYVIEW (1) #define MICROPY_PY_BUILTINS_FROZENSET (1) -- cgit v1.2.3