3838#include "py/stream.h" // for mp_obj_print
3939
4040mp_obj_type_t * mp_obj_get_type (mp_const_obj_t o_in ) {
41- if (MP_OBJ_IS_SMALL_INT (o_in )) {
41+ if (mp_obj_is_small_int (o_in )) {
4242 return (mp_obj_type_t * )& mp_type_int ;
43- } else if (MP_OBJ_IS_QSTR (o_in )) {
43+ } else if (mp_obj_is_qstr (o_in )) {
4444 return (mp_obj_type_t * )& mp_type_str ;
4545 #if MICROPY_PY_BUILTINS_FLOAT
4646 } else if (mp_obj_is_float (o_in )) {
@@ -112,7 +112,7 @@ bool mp_obj_is_true(mp_obj_t arg) {
112112 return 1 ;
113113 } else if (arg == mp_const_none ) {
114114 return 0 ;
115- } else if (MP_OBJ_IS_SMALL_INT (arg )) {
115+ } else if (mp_obj_is_small_int (arg )) {
116116 if (MP_OBJ_SMALL_INT_VALUE (arg ) == 0 ) {
117117 return 0 ;
118118 } else {
@@ -167,7 +167,7 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) {
167167 && !mp_obj_is_float (o1 )
168168 #endif
169169 #if MICROPY_PY_BUILTINS_COMPLEX
170- && !MP_OBJ_IS_TYPE (o1 , & mp_type_complex )
170+ && !mp_obj_is_type (o1 , & mp_type_complex )
171171 #endif
172172 ) {
173173 return true;
@@ -177,8 +177,8 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) {
177177 }
178178
179179 // fast path for small ints
180- if (MP_OBJ_IS_SMALL_INT (o1 )) {
181- if (MP_OBJ_IS_SMALL_INT (o2 )) {
180+ if (mp_obj_is_small_int (o1 )) {
181+ if (mp_obj_is_small_int (o2 )) {
182182 // both SMALL_INT, and not equal if we get here
183183 return false;
184184 } else {
@@ -189,19 +189,19 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) {
189189 }
190190
191191 // fast path for strings
192- if (MP_OBJ_IS_STR (o1 )) {
193- if (MP_OBJ_IS_STR (o2 )) {
192+ if (mp_obj_is_str (o1 )) {
193+ if (mp_obj_is_str (o2 )) {
194194 // both strings, use special function
195195 return mp_obj_str_equal (o1 , o2 );
196196 } else {
197197 // a string is never equal to anything else
198198 goto str_cmp_err ;
199199 }
200- } else if (MP_OBJ_IS_STR (o2 )) {
200+ } else if (mp_obj_is_str (o2 )) {
201201 // o1 is not a string (else caught above), so the objects are not equal
202202 str_cmp_err :
203203 #if MICROPY_PY_STR_BYTES_CMP_WARN
204- if (MP_OBJ_IS_TYPE (o1 , & mp_type_bytes ) || MP_OBJ_IS_TYPE (o2 , & mp_type_bytes )) {
204+ if (mp_obj_is_type (o1 , & mp_type_bytes ) || mp_obj_is_type (o2 , & mp_type_bytes )) {
205205 mp_warning (MP_WARN_CAT (BytesWarning ), "Comparison between bytes and str" );
206206 }
207207 #endif
@@ -230,9 +230,9 @@ mp_int_t mp_obj_get_int(mp_const_obj_t arg) {
230230 return 0 ;
231231 } else if (arg == mp_const_true ) {
232232 return 1 ;
233- } else if (MP_OBJ_IS_SMALL_INT (arg )) {
233+ } else if (mp_obj_is_small_int (arg )) {
234234 return MP_OBJ_SMALL_INT_VALUE (arg );
235- } else if (MP_OBJ_IS_TYPE (arg , & mp_type_int )) {
235+ } else if (mp_obj_is_type (arg , & mp_type_int )) {
236236 return mp_obj_int_get_checked (arg );
237237 } else {
238238 mp_obj_t res = mp_unary_op (MP_UNARY_OP_INT , (mp_obj_t )arg );
@@ -241,7 +241,7 @@ mp_int_t mp_obj_get_int(mp_const_obj_t arg) {
241241}
242242
243243mp_int_t mp_obj_get_int_truncated (mp_const_obj_t arg ) {
244- if (MP_OBJ_IS_INT (arg )) {
244+ if (mp_obj_is_int (arg )) {
245245 return mp_obj_int_get_truncated (arg );
246246 } else {
247247 return mp_obj_get_int (arg );
@@ -256,9 +256,9 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value) {
256256 * value = 0 ;
257257 } else if (arg == mp_const_true ) {
258258 * value = 1 ;
259- } else if (MP_OBJ_IS_SMALL_INT (arg )) {
259+ } else if (mp_obj_is_small_int (arg )) {
260260 * value = MP_OBJ_SMALL_INT_VALUE (arg );
261- } else if (MP_OBJ_IS_TYPE (arg , & mp_type_int )) {
261+ } else if (mp_obj_is_type (arg , & mp_type_int )) {
262262 * value = mp_obj_int_get_checked (arg );
263263 } else {
264264 return false;
@@ -274,10 +274,10 @@ bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value) {
274274 val = 0 ;
275275 } else if (arg == mp_const_true ) {
276276 val = 1 ;
277- } else if (MP_OBJ_IS_SMALL_INT (arg )) {
277+ } else if (mp_obj_is_small_int (arg )) {
278278 val = MP_OBJ_SMALL_INT_VALUE (arg );
279279 #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
280- } else if (MP_OBJ_IS_TYPE (arg , & mp_type_int )) {
280+ } else if (mp_obj_is_type (arg , & mp_type_int )) {
281281 val = mp_obj_int_as_float_impl (arg );
282282 #endif
283283 } else if (mp_obj_is_float (arg )) {
@@ -313,18 +313,18 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
313313 } else if (arg == mp_const_true ) {
314314 * real = 1 ;
315315 * imag = 0 ;
316- } else if (MP_OBJ_IS_SMALL_INT (arg )) {
316+ } else if (mp_obj_is_small_int (arg )) {
317317 * real = MP_OBJ_SMALL_INT_VALUE (arg );
318318 * imag = 0 ;
319319 #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
320- } else if (MP_OBJ_IS_TYPE (arg , & mp_type_int )) {
320+ } else if (mp_obj_is_type (arg , & mp_type_int )) {
321321 * real = mp_obj_int_as_float_impl (arg );
322322 * imag = 0 ;
323323 #endif
324324 } else if (mp_obj_is_float (arg )) {
325325 * real = mp_obj_float_get (arg );
326326 * imag = 0 ;
327- } else if (MP_OBJ_IS_TYPE (arg , & mp_type_complex )) {
327+ } else if (mp_obj_is_type (arg , & mp_type_complex )) {
328328 mp_obj_complex_get (arg , real , imag );
329329 } else {
330330 if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE ) {
@@ -340,9 +340,9 @@ void mp_obj_get_complex(mp_obj_t arg, mp_float_t *real, mp_float_t *imag) {
340340
341341// note: returned value in *items may point to the interior of a GC block
342342void mp_obj_get_array (mp_obj_t o , size_t * len , mp_obj_t * * items ) {
343- if (MP_OBJ_IS_TYPE (o , & mp_type_tuple )) {
343+ if (mp_obj_is_type (o , & mp_type_tuple )) {
344344 mp_obj_tuple_get (o , len , items );
345- } else if (MP_OBJ_IS_TYPE (o , & mp_type_list )) {
345+ } else if (mp_obj_is_type (o , & mp_type_list )) {
346346 mp_obj_list_get (o , len , items );
347347 } else {
348348 if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE ) {
@@ -371,7 +371,7 @@ void mp_obj_get_array_fixed_n(mp_obj_t o, size_t len, mp_obj_t **items) {
371371// is_slice determines whether the index is a slice index
372372size_t mp_get_index (const mp_obj_type_t * type , size_t len , mp_obj_t index , bool is_slice ) {
373373 mp_int_t i ;
374- if (MP_OBJ_IS_SMALL_INT (index )) {
374+ if (mp_obj_is_small_int (index )) {
375375 i = MP_OBJ_SMALL_INT_VALUE (index );
376376 } else if (!mp_obj_get_int_maybe (index , & i )) {
377377 if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE ) {
@@ -409,7 +409,7 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool
409409
410410mp_obj_t mp_obj_id (mp_obj_t o_in ) {
411411 mp_int_t id = (mp_int_t )o_in ;
412- if (!MP_OBJ_IS_OBJ (o_in )) {
412+ if (!mp_obj_is_obj (o_in )) {
413413 return mp_obj_new_int (id );
414414 } else if (id >= 0 ) {
415415 // Many OSes and CPUs have affinity for putting "user" memories
@@ -445,9 +445,9 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) {
445445 if (
446446#if !MICROPY_PY_BUILTINS_STR_UNICODE
447447 // It's simple - unicode is slow, non-unicode is fast
448- MP_OBJ_IS_STR (o_in ) ||
448+ mp_obj_is_str (o_in ) ||
449449#endif
450- MP_OBJ_IS_TYPE (o_in , & mp_type_bytes )) {
450+ mp_obj_is_type (o_in , & mp_type_bytes )) {
451451 GET_STR_LEN (o_in , l );
452452 return MP_OBJ_NEW_SMALL_INT (l );
453453 } else {
0 commit comments