Skip to content

Commit

Permalink
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/marshal/dump_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fails:Marshal.dump with a Time dumps the zone and the offset
fails:Marshal.dump with a Time dumps the zone, but not the offset if zone is UTC
fails:Marshal.dump with an Exception dumps the message for the exception
fails:Marshal.dump with an Exception contains the filename in the backtrace
fails:Marshal.dump with a Symbol dumps a binary encoded Symbol
23 changes: 23 additions & 0 deletions truffle/src/main/ruby/core/rubinius/api/shims/marshal.rb
Original file line number Diff line number Diff line change
@@ -33,6 +33,29 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

class Exception

# Custom marshal dumper for Exception. Rubinius exposes the exception message as an instance variable and their
# dumper takes advantage of that. This dumper instead calls Exception#message to get the message, but is otherwise
# identical.
def __marshal__(ms)
out = ms.serialize_extended_object self
out << "o"
cls = Rubinius::Type.object_class self
name = Rubinius::Type.module_inspect cls
out << ms.serialize(name.to_sym)
out << ms.serialize_fixnum(2)

out << ms.serialize(:mesg)
out << ms.serialize(self.message)
out << ms.serialize(:bt)
out << ms.serialize(self.backtrace)

out
end

end

class Range

# Custom marshal dumper for Range. Rubinius exposes the three main values in Range (begin, end, excl) as

0 comments on commit 65f1253

Please sign in to comment.