summaryrefslogtreecommitdiffstats
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
commitfc035fe32147b8de4b07d80cf61f03995d3269ca (patch)
tree7750c86ba090665963adb024be13d3a32a5488eb /complex.c
parent85b5e64b4a855f7bbe5e43bc54c6dcb30eebc1b9 (diff)
downloadruby-fc035fe32147b8de4b07d80cf61f03995d3269ca.tar.gz
ruby-fc035fe32147b8de4b07d80cf61f03995d3269ca.tar.xz
ruby-fc035fe32147b8de4b07d80cf61f03995d3269ca.zip
* complex.c (nucomp_marshal_{dump,load}): preserve instance
variables. * rational.c (nurat_marshal_{dump,load}): ditto. git-svn-id: http://svn.ruby-lang.org/repos/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 1739cc12b..0ed8a2c45 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;
}