From 0d3dc2ec807c313d0952d15ac4f30bc8586bba2f Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Thu, 17 Dec 2020 14:43:11 -0500 Subject: Make `Hash#except` always return a Hash [Feature #15822] --- hash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 2f53c24647..9b4c315a09 100644 --- a/hash.c +++ b/hash.c @@ -2643,7 +2643,8 @@ rb_hash_except(int argc, VALUE *argv, VALUE hash) int i; VALUE key, result; - result = rb_obj_dup(hash); + result = hash_alloc(rb_cHash); + hash_copy(result, hash); for (i = 0; i < argc; i++) { key = argv[i]; -- cgit v1.2.3