From c0d63ea09f41560f42c9d1f2605723fe5e6fa01c Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 17 Mar 2021 15:14:23 +0900 Subject: hash.c: `Hash#shift` to return `nil` when a hash is empty. It used to be return the default value if available, but it should ignore the default value for behavior consistency. CRuby will adopt this behavior too in the future. [ruby-bugs:16908] --- src/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/hash.c b/src/hash.c index c30a8dec4..3b5d17761 100644 --- a/src/hash.c +++ b/src/hash.c @@ -1506,7 +1506,7 @@ mrb_hash_shift(mrb_state *mrb, mrb_value hash) hash_modify(mrb, hash); if (h_size(h) == 0) { - return hash_default(mrb, hash, mrb_nil_value()); + return mrb_nil_value(); } else { mrb_value del_key, del_val; -- cgit v1.2.3