ruby-changes:57244
From: Nobuyoshi <ko1@a...>
Date: Sun, 25 Aug 2019 11:42:39 +0900 (JST)
Subject: [ruby-changes:57244] Nobuyoshi Nakada: 5decf66ab3 (master): Inspect dynamic symbol as well as static symbol
https://git.ruby-lang.org/ruby.git/commit/?id=5decf66ab3 From 5decf66ab3395193160673ddd80395a5b3b86223 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 25 Aug 2019 07:39:57 +0900 Subject: Inspect dynamic symbol as well as static symbol diff --git a/numeric.c b/numeric.c index 724a7f3..5bf87bd 100644 --- a/numeric.c +++ b/numeric.c @@ -410,7 +410,7 @@ NORETURN(static void coerce_failed(VALUE x, VALUE y)); https://github.com/ruby/ruby/blob/trunk/numeric.c#L410 static void coerce_failed(VALUE x, VALUE y) { - if (SPECIAL_CONST_P(y) || BUILTIN_TYPE(y) == T_FLOAT) { + if (SPECIAL_CONST_P(y) || SYMBOL_P(y) || RB_FLOAT_TYPE_P(y)) { y = rb_inspect(y); } else { diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb index 4e5404a..6073ec1 100644 --- a/test/ruby/test_numeric.rb +++ b/test/ruby/test_numeric.rb @@ -26,6 +26,10 @@ class TestNumeric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_numeric.rb#L26 assert_raise_with_message(TypeError, /:"\\u3042"/) {1&:"\u{3042}"} assert_raise_with_message(TypeError, /:"\\u3042"/) {1|:"\u{3042}"} assert_raise_with_message(TypeError, /:"\\u3042"/) {1^:"\u{3042}"} + assert_raise_with_message(TypeError, /:\u{3044}/) {1+"\u{3044}".to_sym} + assert_raise_with_message(TypeError, /:\u{3044}/) {1&"\u{3044}".to_sym} + assert_raise_with_message(TypeError, /:\u{3044}/) {1|"\u{3044}".to_sym} + assert_raise_with_message(TypeError, /:\u{3044}/) {1^"\u{3044}".to_sym} bug10711 = '[ruby-core:67405] [Bug #10711]' exp = "1.2 can't be coerced into Integer" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/