We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cdc020d commit 79b7fe2Copy full SHA for 79b7fe2
1 file changed
py/objstrunicode.c
@@ -330,8 +330,10 @@ STATIC mp_obj_t str_it_iternext(mp_obj_t self_in) {
330
mp_obj_str_it_t *self = self_in;
331
GET_STR_DATA_LEN(self->str, str, len);
332
if (self->cur < len) {
333
- mp_obj_t o_out = mp_obj_new_str((const char*)str + self->cur, 1, true);
334
- self->cur += 1;
+ const byte *cur = str + self->cur;
+ const byte *end = utf8_next_char(str + self->cur);
335
+ mp_obj_t o_out = mp_obj_new_str((const char*)cur, end - cur, true);
336
+ self->cur += end - cur;
337
return o_out;
338
} else {
339
return MP_OBJ_STOP_ITERATION;
0 commit comments