@@ -49,10 +49,6 @@ STATIC mp_obj_t mp_obj_new_bytes_iterator(mp_obj_t str);
49
49
STATIC NORETURN void bad_implicit_conversion (mp_obj_t self_in );
50
50
STATIC NORETURN void arg_type_mixup ();
51
51
52
- STATIC bool is_str_or_bytes (mp_obj_t o ) {
53
- return MP_OBJ_IS_STR (o ) || MP_OBJ_IS_TYPE (o , & mp_type_bytes );
54
- }
55
-
56
52
/******************************************************************************/
57
53
/* str */
58
54
@@ -388,7 +384,7 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
388
384
}
389
385
390
386
STATIC mp_obj_t str_join (mp_obj_t self_in , mp_obj_t arg ) {
391
- assert (is_str_or_bytes (self_in ));
387
+ assert (MP_OBJ_IS_STR_OR_BYTES (self_in ));
392
388
const mp_obj_type_t * self_type = mp_obj_get_type (self_in );
393
389
394
390
// get separation string
@@ -660,7 +656,7 @@ enum { LSTRIP, RSTRIP, STRIP };
660
656
661
657
STATIC mp_obj_t str_uni_strip (int type , uint n_args , const mp_obj_t * args ) {
662
658
assert (1 <= n_args && n_args <= 2 );
663
- assert (is_str_or_bytes (args [0 ]));
659
+ assert (MP_OBJ_IS_STR_OR_BYTES (args [0 ]));
664
660
const mp_obj_type_t * self_type = mp_obj_get_type (args [0 ]);
665
661
666
662
const byte * chars_to_del ;
@@ -1477,7 +1473,7 @@ STATIC mp_obj_t str_count(uint n_args, const mp_obj_t *args) {
1477
1473
}
1478
1474
1479
1475
STATIC mp_obj_t str_partitioner (mp_obj_t self_in , mp_obj_t arg , mp_int_t direction ) {
1480
- if (!is_str_or_bytes (self_in )) {
1476
+ if (!MP_OBJ_IS_STR_OR_BYTES (self_in )) {
1481
1477
assert (0 );
1482
1478
}
1483
1479
mp_obj_type_t * self_type = mp_obj_get_type (self_in );
@@ -1877,7 +1873,7 @@ const char *mp_obj_str_get_str(mp_obj_t self_in) {
1877
1873
}
1878
1874
1879
1875
const char * mp_obj_str_get_data (mp_obj_t self_in , uint * len ) {
1880
- if (is_str_or_bytes (self_in )) {
1876
+ if (MP_OBJ_IS_STR_OR_BYTES (self_in )) {
1881
1877
GET_STR_DATA_LEN (self_in , s , l );
1882
1878
* len = l ;
1883
1879
return (const char * )s ;
0 commit comments