Skip to content

Commit fb510b3

Browse files
committed
Rename bultins config variables to MICROPY_PY_BUILTINS_*.
This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue adafruit#35 for discussion.
1 parent c60a261 commit fb510b3

39 files changed

+92
-93
lines changed

bare-arm/mpconfigport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
#define MICROPY_HELPER_REPL (0)
1313
#define MICROPY_HELPER_LEXER_UNIX (0)
1414
#define MICROPY_ENABLE_SOURCE_LINE (0)
15+
#define MICROPY_PY_BUILTINS_PROPERTY (0)
1516
#define MICROPY_PY_COLLECTIONS (0)
1617
#define MICROPY_PY_MATH (0)
1718
#define MICROPY_PY_CMATH (0)
1819
#define MICROPY_PY_IO (0)
1920
#define MICROPY_PY_STRUCT (0)
2021
#define MICROPY_PY_SYS (0)
21-
#define MICROPY_PY_PROPERTY (0)
2222
#define MICROPY_CPYTHON_COMPAT (0)
2323
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
2424
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)

py/binary.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ mp_obj_t mp_binary_get_val_array(char typecode, void *p, int index) {
114114
// TODO: Explode API more to cover signedness
115115
return mp_obj_new_int_from_ll(((long long*)p)[index]);
116116
#endif
117-
#if MICROPY_ENABLE_FLOAT
117+
#if MICROPY_PY_BUILTINS_FLOAT
118118
case 'f':
119119
return mp_obj_new_float(((float*)p)[index]);
120120
case 'd':
@@ -217,7 +217,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **
217217

218218
void mp_binary_set_val_array(char typecode, void *p, int index, mp_obj_t val_in) {
219219
switch (typecode) {
220-
#if MICROPY_ENABLE_FLOAT
220+
#if MICROPY_PY_BUILTINS_FLOAT
221221
case 'f':
222222
((float*)p)[index] = mp_obj_float_get(val_in);
223223
break;
@@ -260,7 +260,7 @@ void mp_binary_set_val_array_from_int(char typecode, void *p, int index, machine
260260
((long long*)p)[index] = val;
261261
break;
262262
#endif
263-
#if MICROPY_ENABLE_FLOAT
263+
#if MICROPY_PY_BUILTINS_FLOAT
264264
case 'f':
265265
((float*)p)[index] = val;
266266
break;

py/builtin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "runtime.h"
3838
#include "builtin.h"
3939

40-
#if MICROPY_ENABLE_FLOAT
40+
#if MICROPY_PY_BUILTINS_FLOAT
4141
#include <math.h>
4242
#endif
4343

@@ -104,7 +104,7 @@ mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
104104
val = -val;
105105
}
106106
return MP_OBJ_NEW_SMALL_INT(val);
107-
#if MICROPY_ENABLE_FLOAT
107+
#if MICROPY_PY_BUILTINS_FLOAT
108108
} else if (MP_OBJ_IS_TYPE(o_in, &mp_type_float)) {
109109
mp_float_t value = mp_obj_float_get(o_in);
110110
// TODO check for NaN etc

py/builtintables.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = {
4444
{ MP_OBJ_NEW_QSTR(MP_QSTR_bool), (mp_obj_t)&mp_type_bool },
4545
{ MP_OBJ_NEW_QSTR(MP_QSTR_bytes), (mp_obj_t)&mp_type_bytes },
4646
{ MP_OBJ_NEW_QSTR(MP_QSTR_bytearray), (mp_obj_t)&mp_type_bytearray },
47-
#if MICROPY_ENABLE_FLOAT
47+
#if MICROPY_PY_BUILTINS_FLOAT
4848
{ MP_OBJ_NEW_QSTR(MP_QSTR_complex), (mp_obj_t)&mp_type_complex },
4949
#endif
5050
{ MP_OBJ_NEW_QSTR(MP_QSTR_dict), (mp_obj_t)&mp_type_dict },
5151
{ MP_OBJ_NEW_QSTR(MP_QSTR_enumerate), (mp_obj_t)&mp_type_enumerate },
5252
{ MP_OBJ_NEW_QSTR(MP_QSTR_filter), (mp_obj_t)&mp_type_filter },
53-
#if MICROPY_ENABLE_FLOAT
53+
#if MICROPY_PY_BUILTINS_FLOAT
5454
{ MP_OBJ_NEW_QSTR(MP_QSTR_float), (mp_obj_t)&mp_type_float },
5555
#endif
56-
#if MICROPY_PY_FROZENSET
56+
#if MICROPY_PY_BUILTINS_FROZENSET
5757
{ MP_OBJ_NEW_QSTR(MP_QSTR_frozenset), (mp_obj_t)&mp_type_frozenset },
5858
#endif
5959
{ MP_OBJ_NEW_QSTR(MP_QSTR_int), (mp_obj_t)&mp_type_int },
6060
{ MP_OBJ_NEW_QSTR(MP_QSTR_list), (mp_obj_t)&mp_type_list },
6161
{ MP_OBJ_NEW_QSTR(MP_QSTR_map), (mp_obj_t)&mp_type_map },
6262
{ MP_OBJ_NEW_QSTR(MP_QSTR_object), (mp_obj_t)&mp_type_object },
63-
#if MICROPY_PY_PROPERTY
63+
#if MICROPY_PY_BUILTINS_PROPERTY
6464
{ MP_OBJ_NEW_QSTR(MP_QSTR_property), (mp_obj_t)&mp_type_property },
6565
#endif
6666
{ MP_OBJ_NEW_QSTR(MP_QSTR_range), (mp_obj_t)&mp_type_range },
@@ -169,7 +169,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = {
169169
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_struct },
170170
#endif
171171

172-
#if MICROPY_ENABLE_FLOAT
172+
#if MICROPY_PY_BUILTINS_FLOAT
173173
{ MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&mp_module_math },
174174
#if MICROPY_PY_CMATH
175175
{ MP_OBJ_NEW_QSTR(MP_QSTR_cmath), (mp_obj_t)&mp_module_cmath },

py/modcmath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "obj.h"
3333
#include "builtin.h"
3434

35-
#if MICROPY_ENABLE_FLOAT && MICROPY_PY_CMATH
35+
#if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_CMATH
3636

3737
// These are defined in modmath.c
3838
extern const mp_obj_float_t mp_math_e_obj;
@@ -154,4 +154,4 @@ const mp_obj_module_t mp_module_cmath = {
154154
.globals = (mp_obj_dict_t*)&mp_module_cmath_globals,
155155
};
156156

157-
#endif // MICROPY_ENABLE_FLOAT && MICROPY_PY_CMATH
157+
#endif // MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_CMATH

py/modmath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "obj.h"
3333
#include "builtin.h"
3434

35-
#if MICROPY_ENABLE_FLOAT && MICROPY_PY_MATH
35+
#if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH
3636

3737
//TODO: Change macros to check for overflow and raise OverflowError or RangeError
3838
#define MATH_FUN_1(py_name, c_name) \
@@ -184,4 +184,4 @@ const mp_obj_module_t mp_module_math = {
184184
.globals = (mp_obj_dict_t*)&mp_module_math_globals,
185185
};
186186

187-
#endif // MICROPY_ENABLE_FLOAT && MICROPY_PY_MATH
187+
#endif // MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH

py/mpconfig.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ typedef long long mp_longint_impl_t;
212212
#endif
213213

214214
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
215-
#define MICROPY_ENABLE_FLOAT (1)
215+
#define MICROPY_PY_BUILTINS_FLOAT (1)
216216
#define MICROPY_FLOAT_C_FUN(fun) fun##f
217217
typedef float mp_float_t;
218218
#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
219-
#define MICROPY_ENABLE_FLOAT (1)
219+
#define MICROPY_PY_BUILTINS_FLOAT (1)
220220
#define MICROPY_FLOAT_C_FUN(fun) fun
221221
typedef double mp_float_t;
222222
#else
223-
#define MICROPY_ENABLE_FLOAT (0)
223+
#define MICROPY_PY_BUILTINS_FLOAT (0)
224224
#endif
225225

226226
// Enable features which improve CPython compatibility
@@ -239,20 +239,19 @@ typedef double mp_float_t;
239239
/*****************************************************************************/
240240
/* Fine control over Python builtins, classes, modules, etc */
241241

242-
// Whether to support slice object and correspondingly
243-
// slice subscript operators
244-
#ifndef MICROPY_PY_SLICE
245-
#define MICROPY_PY_SLICE (1)
242+
// Whether to support slice subscript operators and slice object
243+
#ifndef MICROPY_PY_BUILTINS_SLICE
244+
#define MICROPY_PY_BUILTINS_SLICE (1)
246245
#endif
247246

248247
// Whether to support frozenset object
249-
#ifndef MICROPY_PY_FROZENSET
250-
#define MICROPY_PY_FROZENSET (0)
248+
#ifndef MICROPY_PY_BUILTINS_FROZENSET
249+
#define MICROPY_PY_BUILTINS_FROZENSET (0)
251250
#endif
252251

253-
// Whether to support the property object
254-
#ifndef MICROPY_PY_PROPERTY
255-
#define MICROPY_PY_PROPERTY (1)
252+
// Whether to support property object
253+
#ifndef MICROPY_PY_BUILTINS_PROPERTY
254+
#define MICROPY_PY_BUILTINS_PROPERTY (1)
256255
#endif
257256

258257
// Whether to provide "collections" module

py/mpz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ bool mpz_as_int_checked(const mpz_t *i, machine_int_t *value) {
12621262
return true;
12631263
}
12641264

1265-
#if MICROPY_ENABLE_FLOAT
1265+
#if MICROPY_PY_BUILTINS_FLOAT
12661266
mp_float_t mpz_as_float(const mpz_t *i) {
12671267
mp_float_t val = 0;
12681268
mpz_dig_t *d = i->dig + i->len;

py/mpz.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mpz_t *mpz_mod(const mpz_t *lhs, const mpz_t *rhs);
9898

9999
machine_int_t mpz_as_int(const mpz_t *z);
100100
bool mpz_as_int_checked(const mpz_t *z, machine_int_t *value);
101-
#if MICROPY_ENABLE_FLOAT
101+
#if MICROPY_PY_BUILTINS_FLOAT
102102
mp_float_t mpz_as_float(const mpz_t *z);
103103
#endif
104104
uint mpz_as_str_size(const mpz_t *z, uint base);

py/obj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, machine_int_t *value) {
257257
return true;
258258
}
259259

260-
#if MICROPY_ENABLE_FLOAT
260+
#if MICROPY_PY_BUILTINS_FLOAT
261261
mp_float_t mp_obj_get_float(mp_obj_t arg) {
262262
if (arg == mp_const_false) {
263263
return 0;

0 commit comments

Comments
 (0)