diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-12-10 23:00:17 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-12-10 23:00:17 +0900 |
| commit | 994da0fd7375b2ef0fb618db66ffeeac8fd9b383 (patch) | |
| tree | e4ba019202bb26a8abc226438940072fc2c3322c /src/string.c | |
| parent | 543a9f84d11c2c0e96de52bd2e936467f13d26e8 (diff) | |
| parent | bf431e77b8851e87f1a65ad3bf20d7e035b31472 (diff) | |
| download | mruby-994da0fd7375b2ef0fb618db66ffeeac8fd9b383.tar.gz mruby-994da0fd7375b2ef0fb618db66ffeeac8fd9b383.zip | |
Merge pull request #4860 from shuujii/fix-behavior-of-String-to_i-Kernel-Integer-to-numbers-starting-with-_
Fix behavior of `String#to_i`/`Kernel#Integer` to numbers starting with `_`
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c index f75679513..f4fb46e5a 100644 --- a/src/string.c +++ b/src/string.c @@ -2354,7 +2354,7 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, if (*(p - 1) == '0') p--; } - if (p == pend) { + if (p == pend || *p == '_') { if (badcheck) goto bad; return mrb_fixnum_value(0); } |
