From b471e39bd1b68e6f820fcdff5512789e56b779b0 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 21 Jun 2017 02:25:27 +0000 Subject: 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enum.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'enum.c') diff --git a/enum.c b/enum.c index cd77d9ca7a..c744665949 100644 --- a/enum.c +++ b/enum.c @@ -3855,6 +3855,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; } @@ -3862,6 +3863,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; } -- cgit v1.2.3