diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-19 01:52:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-19 01:52:31 +0000 |
commit | 52f966f8756c72655e5c37cfbc5f19b4827e3b10 (patch) | |
tree | 3fd9c6ad1f1f0e026ceeb1302398dc607168dd12 | |
parent | 87c6868350213fe0eac786c3f051621c720eb74d (diff) | |
download | ruby-52f966f8756c72655e5c37cfbc5f19b4827e3b10.tar.gz ruby-52f966f8756c72655e5c37cfbc5f19b4827e3b10.tar.xz ruby-52f966f8756c72655e5c37cfbc5f19b4827e3b10.zip |
* bignum.c (rb_cstr_to_inum): an underscore succeeding after octal
prefix is allowed. [ruby-core:14139]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | bignum.c | 2 | ||||
-rw-r--r-- | test/ruby/test_integer.rb | 3 |
3 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Dec 19 10:52:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * bignum.c (rb_cstr_to_inum): an underscore succeeding after octal + prefix is allowed. [ruby-core:14139] + Wed Dec 19 00:09:19 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * bignum.c (rb_cstr_to_inum): wrong radix check. a patch from @@ -439,7 +439,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck) len = 2; break; case 8: - if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O')) { + if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O'||str[1] == '_')) { str += 2; } case 4: case 5: case 6: case 7: diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb index 81f8c6579..db62a08cc 100644 --- a/test/ruby/test_integer.rb +++ b/test/ruby/test_integer.rb @@ -670,5 +670,8 @@ class TestInteger < Test::Unit::TestCase assert_nothing_raised(ArgumentError, "[ruby-core:13873]") { assert_equal(0, Integer("0 ")) } + assert_nothing_raised(ArgumentError, "[ruby-core:14139]") { + assert_equal(0377, Integer("0_3_7_7")) + } end end |