summaryrefslogtreecommitdiffhomepage
path: root/src/hash.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-03-17 15:14:23 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-03-17 15:14:23 +0900
commitc0d63ea09f41560f42c9d1f2605723fe5e6fa01c (patch)
tree5e8f50af3ac966634471240a623a06091e6a0dd6 /src/hash.c
parent75ae3d3e23cf7c27d66c1eb14e0d09331aa1d8c7 (diff)
downloadmruby-c0d63ea09f41560f42c9d1f2605723fe5e6fa01c.tar.gz
mruby-c0d63ea09f41560f42c9d1f2605723fe5e6fa01c.zip
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]
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c2
1 files changed, 1 insertions, 1 deletions
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;