Project

General

Profile

« Previous | Next » 

Revision 369cfabd

Added by mame (Yusuke Endoh) almost 5 years ago

Make it possible to dump and load an exception object

A backtrace object in an exception had never supported marshalling
correctly: Marshal.load(Marshal.dump(exc)).backtrace_locations dumped
core.

An Exception object has two hidden instance varibles for backtrace data:
one is "bt", which has an Array of Strings, and the other is
"bt_locations", which has an Array of Thread::Backtrace::Locations.
However, Exception's dump outputs data so that the two variables are the
same Array of Strings. Thus, "bt_locations" had a wrong-type object.

For the compatibility, it is difficult to change the dump format. This
changeset fixes the issue by ignoring data for "bt_locations" at the
loading phase if "bt_locations" refers to the same object as "bt".

Future work: Exception's dump should output "bt_locations"
appropriately.

https://bugs.ruby-lang.org/issues/17150