[Bug #20512] Set coderange in Range#each of strings

This commit is contained in:
Nobuyoshi Nakada 2024-05-28 16:59:51 +09:00
parent 0a92c9f2b0
commit 7d144781a9
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -5156,7 +5156,9 @@ rb_str_upto_each(VALUE beg, VALUE end, int excl, int (*each)(VALUE, VALUE), VALU
if (c > e || (excl && c == e)) return beg;
for (;;) {
if ((*each)(rb_enc_str_new(&c, 1, enc), arg)) break;
VALUE str = rb_enc_str_new(&c, 1, enc);
ENC_CODERANGE_SET(str, RUBY_ENC_CODERANGE_7BIT);
if ((*each)(str, arg)) break;
if (!excl && c == e) break;
c++;
if (excl && c == e) break;