Skip to content

Commit 01443a9

Browse files
dhalberttannewt
authored andcommitted
Make chosen features consistent across all boards and ports atmel-samd, esp8266, and nrf.
1. Turn off MICROPY_CPYTHON_COMPAT, which includes a number of minor CPython compatibility features, most of which have workarounds, but uses up significant flash. 2. Turn on MICROPY_PY_SYS_MAXSIZE, which implements sys.maxsize. 3. Turn on MICROPY_CAN_OVERRIDE_BUILTINS, which implements "_" as the most recent value in the REPL, and also enables redefining builtins.
1 parent d201ac2 commit 01443a9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

ports/atmel-samd/mpconfigport.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
77

88
// options to control how MicroPython is built
9-
109
#define MICROPY_QSTR_BYTES_IN_HASH (1)
1110
#define MICROPY_ALLOC_PATH_MAX (256)
1211
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
1312
// TODO(tannewt): Reduce this number if we want the REPL to function under 512
1413
// free bytes.
1514
// #define MICROPY_ALLOC_PARSE_RULE_INIT (64)
15+
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
1616
#define MICROPY_EMIT_X64 (0)
1717
#define MICROPY_EMIT_THUMB (0)
1818
#define MICROPY_EMIT_INLINE_THUMB (0)
1919
#define MICROPY_COMP_MODULE_CONST (1)
2020
#define MICROPY_COMP_CONST (1)
2121
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
2222
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1)
23+
// Turn off for consistency
24+
#define MICROPY_CPYTHON_COMPAT (0)
2325
#define MICROPY_MEM_STATS (0)
2426
#define MICROPY_DEBUG_PRINTERS (0)
2527
#define MICROPY_ENABLE_GC (1)
@@ -59,6 +61,7 @@
5961
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
6062
#define MICROPY_PY_STRUCT (0)
6163
#define MICROPY_PY_SYS (1)
64+
#define MICROPY_PY_SYS_MAXSIZE (1)
6265
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
6366
#define MICROPY_STREAMS_NON_BLOCK (1)
6467

@@ -186,8 +189,6 @@ extern const struct _mp_obj_module_t usb_hid_module;
186189

187190
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (1)
188191
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
189-
#define MICROPY_PY_SYS_MAXSIZE (1)
190-
#define MICROPY_CPYTHON_COMPAT (1)
191192
// Scan gamepad every 32ms
192193
#define CIRCUITPY_GAMEPAD_TICKS 0x1f
193194

@@ -206,7 +207,6 @@ extern const struct _mp_obj_module_t usb_hid_module;
206207
#define MICROPY_PY_BUILTINS_COMPLEX (0)
207208

208209
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
209-
#define MICROPY_CPYTHON_COMPAT (0)
210210
#endif
211211

212212
// Disabled for now.

ports/esp8266/mpconfigport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#define MICROPY_PY_FRAMEBUF (1)
8888
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
8989
#define MICROPY_PY_OS_DUPTERM (1)
90-
#define MICROPY_CPYTHON_COMPAT (1)
90+
#define MICROPY_CPYTHON_COMPAT (0)
9191
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
9292
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
9393
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)

ports/nrf/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#define mp_builtin_open_obj mp_vfs_open_obj
8282
#endif
8383

84+
#define MICROPY_CPYTHON_COMPAT (0)
8485
#define MICROPY_STREAMS_NON_BLOCK (1)
8586
#define MICROPY_MODULE_WEAK_LINKS (1)
8687
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy