File tree Expand file tree Collapse file tree 3 files changed +3
-13
lines changed
Expand file tree Collapse file tree 3 files changed +3
-13
lines changed Original file line number Diff line number Diff line change 3333#include "py/obj.h"
3434#include "py/objtype.h"
3535#include "py/objint.h"
36+ #include "py/objstr.h"
3637#include "py/runtime0.h"
3738#include "py/runtime.h"
3839#include "py/stackctrl.h"
@@ -422,7 +423,8 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) {
422423 MP_OBJ_IS_STR (o_in ) ||
423424#endif
424425 MP_OBJ_IS_TYPE (o_in , & mp_type_bytes )) {
425- return MP_OBJ_NEW_SMALL_INT (mp_obj_str_get_len (o_in ));
426+ GET_STR_LEN (o_in , l );
427+ return MP_OBJ_NEW_SMALL_INT (l );
426428 } else {
427429 mp_obj_type_t * type = mp_obj_get_type (o_in );
428430 if (type -> unary_op != NULL ) {
Original file line number Diff line number Diff line change @@ -560,8 +560,6 @@ void mp_init_emergency_exception_buf(void);
560560
561561// str
562562bool mp_obj_str_equal (mp_obj_t s1 , mp_obj_t s2 );
563- mp_uint_t mp_obj_str_get_hash (mp_obj_t self_in );
564- mp_uint_t mp_obj_str_get_len (mp_obj_t self_in );
565563qstr mp_obj_str_get_qstr (mp_obj_t self_in ); // use this if you will anyway convert the string to a qstr
566564const char * mp_obj_str_get_str (mp_obj_t self_in ); // use this only if you need the string to be null terminated
567565const char * mp_obj_str_get_data (mp_obj_t self_in , mp_uint_t * len );
Original file line number Diff line number Diff line change @@ -1996,16 +1996,6 @@ STATIC void bad_implicit_conversion(mp_obj_t self_in) {
19961996 }
19971997}
19981998
1999- mp_uint_t mp_obj_str_get_len (mp_obj_t self_in ) {
2000- // TODO This has a double check for the type, one in obj.c and one here
2001- if (MP_OBJ_IS_STR_OR_BYTES (self_in )) {
2002- GET_STR_LEN (self_in , l );
2003- return l ;
2004- } else {
2005- bad_implicit_conversion (self_in );
2006- }
2007- }
2008-
20091999// use this if you will anyway convert the string to a qstr
20102000// will be more efficient for the case where it's already a qstr
20112001qstr mp_obj_str_get_qstr (mp_obj_t self_in ) {
You can’t perform that action at this time.
0 commit comments