Actions
Bug #8041
closedMarshal incompatibility with prepend
Description
=begin
Marshal doesn't work for objects with prepended modules:
o = Object.new
o.singleton_class.send :include, Enumerable
Marshal.load(Marshal.dump(o)) # => ok
o = Object.new
o.singleton_class.send :prepend, Enumerable
Marshal.load(Marshal.dump(o)) # => ArgumentError: Object does not refer to module
=end
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
- Description updated (diff)
=begin
To be honest, I haven't considered about marshaling prepended objects at all.
How could we represent it?
(1) add new type, (({TYPE_PREEXTEND})) for example.
(2) allow the current dumped format and treat the class in extending modules as the mark of prepend.
The former may need marshal version to bump up, I don't want it.
=end
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r39642.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
marshal.c: prepended objects
- marshal.c (r_object0): load prepended objects. treat the class of
extended object in the included modules as prepended singleton
class. [ruby-core:53202] [Bug #8041]
Actions
Like0
Like0Like0