mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 11:10:14 +01:00
py/objstr: Fix mix-signed comparison in str.center().
This commit is contained in:
@@ -820,7 +820,7 @@ STATIC mp_obj_t str_rstrip(size_t n_args, const mp_obj_t *args) {
|
||||
#if MICROPY_PY_BUILTINS_STR_CENTER
|
||||
STATIC mp_obj_t str_center(mp_obj_t str_in, mp_obj_t width_in) {
|
||||
GET_STR_DATA_LEN(str_in, str, str_len);
|
||||
int width = mp_obj_get_int(width_in);
|
||||
mp_uint_t width = mp_obj_get_int(width_in);
|
||||
if (str_len >= width) {
|
||||
return str_in;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user