Forum: Ruby-core [ruby-trunk - Bug #8041][Open] Marshal incompatibility with prepend

0e610136db92027148906c92d57fdb36?d=identicon&s=25 marcandre (Marc-Andre Lafortune) (Guest)
on 2013-03-08 00:13
(Received via mailing list)
Issue #8041 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #8041: Marshal incompatibility with prepend
https://bugs.ruby-lang.org/issues/8041

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Low
Assignee:
Category: core
Target version: current: 2.1.0
ruby -v: r39629


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
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2013-03-08 08:35
(Received via mailing list)
Issue #8041 has been updated by nobu (Nobuyoshi Nakada).

Description updated

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.

----------------------------------------
Bug #8041: Marshal incompatibility with prepend
https://bugs.ruby-lang.org/issues/8041#change-37383

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Low
Assignee:
Category: core
Target version: current: 2.1.0
ruby -v: r39629


=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
This topic is locked and can not be replied to.