From: nobuyoshi nakada Date: 2005-10-06T19:18:24+09:00 Subject: [ruby-dev:27397] Re: fail on test/rss なかだです。 At Thu, 6 Oct 2005 13:39:37 +0900, Yukihiro Matsumoto wrote in [ruby-dev:27395]: > その後考えたのですが、 > > * nil.to_aは復活させる > * Array()はto_ary,to_aを試し、どちらもなければ例外 > > という仕様はどうかと考えています。非互換ですが。 多重代入元が多値かどうかわからないときに無闇に*をつけるのはよくない、と いうことでしょうか。 Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.835 diff -U2 -p -u -r1.835 eval.c --- eval.c 5 Oct 2005 16:15:16 -0000 1.835 +++ eval.c 6 Oct 2005 09:57:38 -0000 @@ -2646,5 +2646,13 @@ static VALUE splat_value(VALUE v) { - return rb_values_from_ary(rb_convert_type(v, T_ARRAY, "Array", "to_a")); + VALUE tmp = rb_check_array_type(v); + + if (NIL_P(tmp)) { + v = rb_convert_type(v, T_ARRAY, "Array", "to_a"); + } + else { + v = tmp; + } + return rb_values_from_ary(v); } Index: test/net/http/test_http.rb =================================================================== RCS file: /cvs/ruby/src/ruby/test/net/http/test_http.rb,v retrieving revision 1.2 diff -U2 -p -r1.2 test_http.rb --- test/net/http/test_http.rb 24 Sep 2005 11:25:29 -0000 1.2 +++ test/net/http/test_http.rb 6 Oct 2005 05:23:52 -0000 @@ -32,5 +32,5 @@ module TestNetHTTP_version_1_1_methods def _test_get__get(http) - res, body = *http.get('/') + res, body = http.get('/') assert_kind_of Net::HTTPResponse, res assert_kind_of String, res.body @@ -62,5 +62,5 @@ module TestNetHTTP_version_1_1_methods def _test_get__chunked(http) buf = '' - res, body = *http.get('/') {|s| buf << s } + res, body = http.get('/') {|s| buf << s } assert_kind_of Net::HTTPResponse, res # assert_kind_of String, res.body @@ -87,5 +87,5 @@ module TestNetHTTP_version_1_1_methods def test_get__implicit_start - res, body = *new().get('/') + res, body = new().get('/') assert_kind_of Net::HTTPResponse, res assert_kind_of String, body -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦