aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-19 10:58:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-19 10:58:08 +0000
commitc9a38187dc3b9d159a45f771521e44187f995a1b (patch)
tree5b75416cb98cce2e74ffb3208027a8af8608ca37 /complex.c
parentfc6784d28d92fddb4167c585863385d4903fd8a1 (diff)
downloadruby-c9a38187dc3b9d159a45f771521e44187f995a1b.tar.gz
freeze Complex and Rational
* complex.c (nucomp_s_new_internal, nucomp_loader): Complex instances are always frozen now. [Feature #13983] * rational.c (nurat_s_new_internal, nurat_loader): Rational instances are always frozen now. [Feature #13983] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/complex.c b/complex.c
index 5d84106441..b340a55502 100644
--- a/complex.c
+++ b/complex.c
@@ -298,6 +298,7 @@ nucomp_s_new_internal(VALUE klass, VALUE real, VALUE imag)
RCOMPLEX_SET_REAL(obj, real);
RCOMPLEX_SET_IMAG(obj, imag);
+ OBJ_FREEZE_RAW(obj);
return (VALUE)obj;
}
@@ -1406,6 +1407,7 @@ nucomp_loader(VALUE self, VALUE a)
RCOMPLEX_SET_REAL(dat, rb_ivar_get(a, id_i_real));
RCOMPLEX_SET_IMAG(dat, rb_ivar_get(a, id_i_imag));
+ OBJ_FREEZE_RAW(self);
return self;
}