From 06593fb0f23dfc12f482561fbec1717dca0d4db4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 19 Jun 2015 12:49:10 +0000 Subject: py: Use a wrapper to explicitly check self argument of builtin methods. Previous to this patch a call such as list.append(1, 2) would lead to a seg fault. This is because list.append is a builtin method and the first argument to such methods is always assumed to have the correct type. Now, when a builtin method is extracted like this it is wrapped in a checker object which checks the the type of the first argument before calling the builtin function. This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and is enabled by default. See issue #1216. --- unix/mpconfigport_minimal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'unix') diff --git a/unix/mpconfigport_minimal.h b/unix/mpconfigport_minimal.h index 078f5a1d1..770188a60 100644 --- a/unix/mpconfigport_minimal.h +++ b/unix/mpconfigport_minimal.h @@ -44,6 +44,7 @@ #define MICROPY_OPT_COMPUTED_GOTO (0) #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (0) #define MICROPY_CAN_OVERRIDE_BUILTINS (0) +#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0) #define MICROPY_CPYTHON_COMPAT (0) #define MICROPY_PY_BUILTINS_BYTEARRAY (0) #define MICROPY_PY_BUILTINS_MEMORYVIEW (0) -- cgit v1.2.3