Project

General

Profile

Actions

Bug #8041

closed

Marshal incompatibility with prepend

Added by marcandre (Marc-Andre Lafortune) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
r39629
Backport:
[ruby-core:53202]

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

Actions #2

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

Also available in: Atom PDF

Like0
Like0Like0