take-cheeze / mruby-marshal

mruby implementation of cruby marshaling.
12 stars 9 forks source link

Dumping object issue #11

Closed Moon4u closed 9 years ago

Moon4u commented 9 years ago

So, I have the following code:

class B
  def initialize
    @a = 3
  end
end
a = B.new
Marshal.dump(a)
f = Marshal.load(a)

This hits assert(false) in the symbol function after the load function

mruby bytes

> Marshal.dump(B.new).bytes
 => [4, 8, 111, 58, 6, 66, 59, 0, 0]

ruby bytes

> Marshal.dump(B.new).bytes.to_a
=> [4, 8, 111, 58, 6, 66, 6, 58, 7, 64, 97, 105, 8]

I'm currently trying to figure out why this happens, but the Marshal module is new for me. Any help is welcome.

take-cheeze commented 9 years ago

Sorry. This seems to caused by bad implementation. Will fix soon.

BTW bytes isn't required since string printing of ruby is useful in marshal format checking.