diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-22 02:02:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-22 02:02:11 +0000 |
commit | 31ef3124a9db534abcc3e323f5d3cb696eda3bf5 (patch) | |
tree | b1c6f0327fb570019586b007bcce785d6c495b99 /object.c | |
parent | 4096f39dcf41628d2248ac2a7dcbd9f45751946a (diff) |
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
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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) { |