Bug #9675
closedMarshal.load fails with recursive structures and user defined hash method
Description
If a user class redefines hash to something that depends on instance variables, and the object is loaded both before a hash, and as a key of a hash of one of its own instance variables (that's loaded before the instance variables needed for the #hash method), it will fail.
It seems like the hash should be constructed during loading without calling #hash, and then after the load has completed, call #rehash on all of the loaded hashes. This should fix any form of nested data structures.
I can repro in 1.9.3p286, 1.9.3p484, and 2.1.0p0 at the least. I discovered when upgrading a far more complicated application from 1.9.3p286 to 1.9.3p484 caused a change in the order of instance variables, thereby triggering the issue. My reduced test case (attached) hits the issue in both versions, though.
Files