summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-05 03:24:54 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-05 03:24:54 +0000
commit90645fd4371abcb63d4fdce7ed75d14fb265125e (patch)
tree9f578f62d3fa2b725c7047173e8010ecf8d6f98c /enum.c
parent5cf363247595a43e58c919f11c5fc5883871b8a9 (diff)
merge revision(s) 59128: [Backport #13669]
Fix Enumerable#uniq with non single yield arguments * enum.c (uniq_func, uniq_iter): need packed value as the unique key. [ruby-core:81734] [Bug #13669] [Fix GH-1658] Author: Kenichi Kamiya <kachick1@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/enum.c b/enum.c
index 5c0634d8d9..1b0e3ade10 100644
--- a/enum.c
+++ b/enum.c
@@ -3847,6 +3847,7 @@ enum_sum(int argc, VALUE* argv, VALUE obj)
static VALUE
uniq_func(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
{
+ ENUM_WANT_SVALUE();
rb_hash_add_new_element(hash, i, i);
return Qnil;
}
@@ -3854,6 +3855,7 @@ uniq_func(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
static VALUE
uniq_iter(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
{
+ ENUM_WANT_SVALUE();
rb_hash_add_new_element(hash, rb_yield_values2(argc, argv), i);
return Qnil;
}