summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-12-10 23:00:17 +0900
committerGitHub <[email protected]>2019-12-10 23:00:17 +0900
commit994da0fd7375b2ef0fb618db66ffeeac8fd9b383 (patch)
treee4ba019202bb26a8abc226438940072fc2c3322c /src
parent543a9f84d11c2c0e96de52bd2e936467f13d26e8 (diff)
parentbf431e77b8851e87f1a65ad3bf20d7e035b31472 (diff)
downloadmruby-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')
-rw-r--r--src/string.c2
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);
}