From 31ef3124a9db534abcc3e323f5d3cb696eda3bf5 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 22 Feb 2017 02:02:11 +0000 Subject: numeric.c: Numeric#clone and #dup * numeric.c (num_clone, num_dup): no longer raises TypeError, returns the receiver instead as well as Integer and Float. [ruby-core:79636] [Bug #13237] * object.c (rb_immutable_obj_clone): immutable object clone with freeze optional keyword argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- object.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'object.c') diff --git a/object.c b/object.c index 4dad9b7491..9ec96687e9 100644 --- a/object.c +++ b/object.c @@ -309,6 +309,9 @@ special_object_p(VALUE obj) case T_BIGNUM: case T_FLOAT: case T_SYMBOL: + case T_RATIONAL: + case T_COMPLEX: + /* not a comprehensive list */ return TRUE; default: return FALSE; @@ -349,6 +352,13 @@ rb_obj_clone2(int argc, VALUE *argv, VALUE obj) return immutable_obj_clone(obj, kwfreeze); } +VALUE +rb_immutable_obj_clone(int argc, VALUE *argv, VALUE obj) +{ + int kwfreeze = freeze_opt(argc, argv); + return immutable_obj_clone(obj, kwfreeze); +} + static int freeze_opt(int argc, VALUE *argv) { -- cgit v1.2.3