ruby-changes:31995
From: nobu <ko1@a...>
Date: Sun, 8 Dec 2013 20:25:12 +0900 (JST)
Subject: [ruby-changes:31995] nobu:r44074 (trunk): hash.c: reject shoult infect
nobu 2013-12-08 20:25:06 +0900 (Sun, 08 Dec 2013) New Revision: 44074 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44074 Log: hash.c: reject shoult infect * hash.c (rb_hash_reject): result should be infected by the receiver. Modified files: trunk/hash.c trunk/test/ruby/test_hash.rb Index: hash.c =================================================================== --- hash.c (revision 44073) +++ hash.c (revision 44074) @@ -1119,6 +1119,7 @@ rb_hash_reject(VALUE hash) https://github.com/ruby/ruby/blob/trunk/hash.c#L1119 RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size); ret = hash_alloc(rb_obj_class(hash)); + OBJ_INFECT(ret, hash); if (!RHASH_EMPTY_P(hash)) { rb_hash_foreach(hash, reject_i, ret); } Index: test/ruby/test_hash.rb =================================================================== --- test/ruby/test_hash.rb (revision 44073) +++ test/ruby/test_hash.rb (revision 44074) @@ -555,6 +555,8 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L555 assert_equal(h3, h.reject {|k,v| v }) assert_equal(base, h) + + assert_predicate(h.taint.reject {true}, :tainted?) end def test_reject! -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/