mirror of
https://github.com/micropython/micropython.git
synced 2026-03-11 03:10:17 +01:00
nrf/mpconfigport: Remove duplicate help and open from builtins module.
The `builtins.help` function is automatically included when `MICROPY_PY_BUILTINS_HELP` is enabled, which is true for this port. The `builtins.open` function is automatically included when `MICROPY_PY_IO` is enabled, which is true when `MICROPY_VFS` is enabled on this port. If `MICROPY_MBFS` is enabled instead of the VFS then `open` must be explicitly provided. Tested on: - ARDUINO_NANO_33_BLE_SENSE: now has only a single `help` and `open` - MICROBIT: now has only a single `help` and `open` - MICROBIT with MICROPY_MBFS enabled: `help` and `open` both still exist and `open` works with mbfs Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -312,11 +312,6 @@ mp_lexer_t *mp_lexer_new_from_file(qstr filename) {
|
||||
mp_import_stat_t mp_import_stat(const char *path) {
|
||||
return MP_IMPORT_STAT_NO_EXIST;
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
|
||||
mp_raise_OSError(MP_EPERM);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -353,10 +353,11 @@ long unsigned int rng_generate_random_word(void);
|
||||
#include "boardmodules.h"
|
||||
#endif // BOARD_SPECIFIC_MODULES
|
||||
|
||||
// extra built in names to add to the global namespace
|
||||
#if MICROPY_MBFS
|
||||
// The builtins.open function must be explicitly added when using the micro:bit filesystem.
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
{ MP_ROM_QSTR(MP_QSTR_help), MP_ROM_PTR(&mp_builtin_help_obj) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
|
||||
#endif
|
||||
|
||||
// extra constants
|
||||
#define MICROPY_PORT_CONSTANTS \
|
||||
|
||||
Reference in New Issue
Block a user