Project

General

Profile

Actions

Bug #1744

closed

Error with Marshal dump/load on a delegated class.

Added by DarKo (Guillaume Delugré) almost 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2dev (2009-11-17 trunk 25805) [i386-darwin9.8.0]
Backport:
[ruby-core:24211]

Description

=begin
Instance variables are not handled when using Marshal with a delegated class.

Here is an example :
on Ruby 1.8, the instance variable @var will be copied fine.
on Ruby 1.9.1, it is set to nil.

It seems to only occur with class inherited from DelegateClass.

==================================
require 'delegate'

class C < DelegateClass(Integer)
attr_accessor :var

def initialize
@var = 1
end
end

c = C.new
p c.var # => 1

d = Marshal.load(Marshal.dump(c))
p d.var # => nil on Ruby 1.9

=end


Files

ex.rb (195 Bytes) ex.rb Example file DarKo (Guillaume Delugré), 07/09/2009 04:41 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0