summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-16 10:21:23 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-16 10:21:23 +0000
commit7c3b57b5d15e3a9a1a82523478f1b4f7035d405d (patch)
tree7750c86ba090665963adb024be13d3a32a5488eb /complex.c
parent73c8f0238448cfb401b1d2e7afec44763defd833 (diff)
* complex.c (nucomp_marshal_{dump,load}): preserve instance
variables. * rational.c (nurat_marshal_{dump,load}): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/complex.c b/complex.c
index 1739cc12b1..0ed8a2c45c 100644
--- a/complex.c
+++ b/complex.c
@@ -937,8 +937,12 @@ nucomp_inspect(VALUE self)
static VALUE
nucomp_marshal_dump(VALUE self)
{
+ VALUE a;
get_dat1(self);
- return rb_assoc_new(dat->real, dat->image);
+
+ a = rb_assoc_new(dat->real, dat->image);
+ rb_copy_generic_ivar(a, self);
+ return a;
}
static VALUE
@@ -947,6 +951,7 @@ nucomp_marshal_load(VALUE self, VALUE a)
get_dat1(self);
dat->real = RARRAY_PTR(a)[0];
dat->image = RARRAY_PTR(a)[1];
+ rb_copy_generic_ivar(self, a);
return self;
}