Skip to content

Commit 2eba98f

Browse files
committed
all: Use MP_REGISTER_EXTENSIBLE_MODULE for overrideable built-ins.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
1 parent 24c02c4 commit 2eba98f

47 files changed

Lines changed: 68 additions & 48 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extmod/modbinascii.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,6 @@ const mp_obj_module_t mp_module_binascii = {
203203
.globals = (mp_obj_dict_t *)&mp_module_binascii_globals,
204204
};
205205

206-
MP_REGISTER_MODULE(MP_QSTR_binascii, mp_module_binascii);
206+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_binascii, mp_module_binascii);
207207

208208
#endif // MICROPY_PY_BINASCII

extmod/modbluetooth.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,11 @@ const mp_obj_module_t mp_module_bluetooth = {
10041004
.globals = (mp_obj_dict_t *)&mp_module_bluetooth_globals,
10051005
};
10061006

1007-
MP_REGISTER_MODULE(MP_QSTR_bluetooth, mp_module_bluetooth);
1007+
// This module should not be extensible (as it is not a CPython standard
1008+
// library nor is it necessary to override from the filesystem), however it
1009+
// has previously been known as `ubluetooth`, so by making it extensible the
1010+
// `ubluetooth` alias will continue to work.
1011+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_bluetooth, mp_module_bluetooth);
10081012

10091013
// Helpers
10101014

extmod/modcryptolib.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ const mp_obj_module_t mp_module_cryptolib = {
375375
.globals = (mp_obj_dict_t *)&mp_module_cryptolib_globals,
376376
};
377377

378-
MP_REGISTER_MODULE(MP_QSTR_cryptolib, mp_module_cryptolib);
378+
// This module should not be extensible (as it is not a CPython standard
379+
// library nor is it necessary to override from the filesystem), however it
380+
// has previously been known as `ucryptolib`, so by making it extensible the
381+
// `ucryptolib` alias will continue to work.
382+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_cryptolib, mp_module_cryptolib);
379383

380384
#endif // MICROPY_PY_CRYPTOLIB

extmod/modhashlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,6 @@ const mp_obj_module_t mp_module_hashlib = {
374374
.globals = (mp_obj_dict_t *)&mp_module_hashlib_globals,
375375
};
376376

377-
MP_REGISTER_MODULE(MP_QSTR_hashlib, mp_module_hashlib);
377+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_hashlib, mp_module_hashlib);
378378

379379
#endif // MICROPY_PY_HASHLIB

extmod/modheapq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const mp_obj_module_t mp_module_heapq = {
118118
.globals = (mp_obj_dict_t *)&mp_module_heapq_globals,
119119
};
120120

121-
MP_REGISTER_MODULE(MP_QSTR_heapq, mp_module_heapq);
121+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_heapq, mp_module_heapq);
122122
#endif
123123

124124
#endif // MICROPY_PY_HEAPQ

extmod/modjson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,6 @@ const mp_obj_module_t mp_module_json = {
381381
.globals = (mp_obj_dict_t *)&mp_module_json_globals,
382382
};
383383

384-
MP_REGISTER_MODULE(MP_QSTR_json, mp_module_json);
384+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_json, mp_module_json);
385385

386386
#endif // MICROPY_PY_JSON

extmod/modlwip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ const mp_obj_module_t mp_module_lwip = {
18021802
MP_REGISTER_MODULE(MP_QSTR_lwip, mp_module_lwip);
18031803

18041804
// On LWIP-ports, this is the socket module (replaces extmod/modsocket.c).
1805-
MP_REGISTER_MODULE(MP_QSTR_socket, mp_module_lwip);
1805+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_socket, mp_module_lwip);
18061806

18071807
MP_REGISTER_ROOT_POINTER(mp_obj_t lwip_slip_stream);
18081808

extmod/modos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ const mp_obj_module_t mp_module_os = {
195195
.globals = (mp_obj_dict_t *)&os_module_globals,
196196
};
197197

198-
MP_REGISTER_MODULE(MP_QSTR_os, mp_module_os);
198+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_os, mp_module_os);
199199

200200
#endif // MICROPY_PY_OS

extmod/modplatform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ const mp_obj_module_t mp_module_platform = {
7575
.globals = (mp_obj_dict_t *)&modplatform_globals,
7676
};
7777

78-
MP_REGISTER_MODULE(MP_QSTR_platform, mp_module_platform);
78+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_platform, mp_module_platform);
7979

8080
#endif // MICROPY_PY_PLATFORM

extmod/modrandom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ const mp_obj_module_t mp_module_random = {
255255
.globals = (mp_obj_dict_t *)&mp_module_random_globals,
256256
};
257257

258-
MP_REGISTER_MODULE(MP_QSTR_random, mp_module_random);
258+
MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_random, mp_module_random);
259259
#endif
260260

261261
#endif // MICROPY_PY_RANDOM

0 commit comments

Comments
 (0)