aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-17 11:15:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-17 11:15:00 +0000
commit571955c13fc9363b16756c8419d6ea9bcd8de06f (patch)
treeee9a420610a1c2de8839c3e055a9b293dc442b56
parentcf460c34f705832090f41dfc6585dff2536623bf (diff)
downloadruby-571955c13fc9363b16756c8419d6ea9bcd8de06f.tar.gz
hash.c: revert
* hash.c (rb_hash_reject): revert to deprecated behavior, with warnings, due to compatibility for HashWithDifferentAccess. [ruby-core:59154] [Bug #9223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--NEWS7
-rw-r--r--hash.c2
-rw-r--r--test/ruby/test_hash.rb2
4 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index bfa8db900e..595f2cf058 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Dec 17 20:15:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@iDaemons.org>
* misc/ruby-electric.el: Import version 2.1.1 from
diff --git a/NEWS b/NEWS
index 504460ef24..59251a40cf 100644
--- a/NEWS
+++ b/NEWS
@@ -135,9 +135,10 @@ with all sufficient information, see the ChangeLog file.
* 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:
diff --git a/hash.c b/hash.c
index 3714c01c62..6a724d1458 100644
--- a/hash.c
+++ b/hash.c
@@ -32,7 +32,7 @@
(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);
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 3273d66c45..169157bdfd 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -558,6 +558,8 @@ class TestHash < Test::Unit::TestCase
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