ruby-changes:32184
From: nobu <ko1@a...>
Date: Tue, 17 Dec 2013 20:15:07 +0900 (JST)
Subject: [ruby-changes:32184] nobu:r44263 (trunk): hash.c: revert
nobu 2013-12-17 20:15:00 +0900 (Tue, 17 Dec 2013) New Revision: 44263 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44263 Log: hash.c: revert * hash.c (rb_hash_reject): revert to deprecated behavior, with warnings, due to compatibility for HashWithDifferentAccess. [ruby-core:59154] [Bug #9223] Modified files: trunk/ChangeLog trunk/NEWS trunk/hash.c trunk/test/ruby/test_hash.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 44262) +++ ChangeLog (revision 44263) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 17 20:15:00 2013 Nobuyoshi Nakada <nobu@r...> + + * hash.c (rb_hash_reject): revert to deprecated behavior, with + warnings, due to compatibility for HashWithDifferentAccess. + [ruby-core:59154] [Bug #9223] + Tue Dec 17 17:30:56 2013 Akinori MUSHA <knu@i...> * misc/ruby-electric.el: Import version 2.1.1 from Index: hash.c =================================================================== --- hash.c (revision 44262) +++ hash.c (revision 44263) @@ -32,7 +32,7 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L32 (klass = 0, \ FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \ !NIL_P(RHASH_IFNONE(hash)))) -#define HASH_REJECT_COPY_MISC_ATTRIBUTES 0 +#define HASH_REJECT_COPY_MISC_ATTRIBUTES 1 static VALUE rb_hash_s_try_convert(VALUE, VALUE); Index: NEWS =================================================================== --- NEWS (revision 44262) +++ NEWS (revision 44263) @@ -135,9 +135,10 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L135 * Hash * incompatible changes: - * Hash#reject now returns plain Hash object, that is the original object's - subclass, instance variables, default value, and taintedness are no longer - copied. + * Hash#reject will return plain Hash object in the future versions, that + is the original object's subclass, instance variables, default value, + and taintedness will be no longer copied, so now warnings are emitted + when called with such Hash. * IO * incompatible changes: Index: test/ruby/test_hash.rb =================================================================== --- test/ruby/test_hash.rb (revision 44262) +++ test/ruby/test_hash.rb (revision 44263) @@ -558,6 +558,8 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L558 assert_equal(h3, h.reject {|k,v| v }) assert_equal(base, h) + return unless RUBY_VERSION > "2.1.0" + h.instance_variable_set(:@foo, :foo) h.default = 42 h.taint -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/