Issue #7348 has been reported by tenderlovemaking (Aaron Patterson). ---------------------------------------- Bug #7348: marshaling an object by a float does not work https://bugs.ruby-lang.org/issues/7348 Author: tenderlovemaking (Aaron Patterson) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0dev (2012-11-14 trunk 37650) [x86_64-darwin12.2.1] The below `calls` object doesn't round trip through marshal on edge ruby: def test_marshal_object_and_float e = Object.new calls = [] calls << [2.0, e] calls << [e] assert_equal calls, Marshal.load(Marshal.dump(calls)) end When I run this test case, for some reason, the float takes the place of the object in the second array: [36/82] TestMarshal#test_marshal_object_and_float = 0.00 s 1) Failure: test_marshal_object_and_float(TestMarshal) [/Users/aaron/git/ruby/test/ruby/test_marshal.rb:40]: <[[2.0, #<Object:0x007fa5c20b08a0>], [#<Object:0x007fa5c20b08a0>]]> expected but was <[[2.0, #<Object:0x007fa5c20b05a8>], [2.0]]>. I've attached a failing test case.
on 2012-11-14 01:22
on 2012-11-14 03:15
Issue #7348 has been updated by mrkn (Kenta Murata). irb(main):006:0> e = Object.new irb(main):007:0> Marshal.load(Marshal.dump([[2.0e-100, e], [e]])) => [[2.0e-100, #<Object:0x007fa45a10bc28>], [#<Object:0x007fa45a10bc28>]] Therefore it is related to flonum. ---------------------------------------- Bug #7348: marshaling an object by a float does not work https://bugs.ruby-lang.org/issues/7348#change-32885 Author: tenderlovemaking (Aaron Patterson) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0dev (2012-11-14 trunk 37650) [x86_64-darwin12.2.1] The below `calls` object doesn't round trip through marshal on edge ruby: def test_marshal_object_and_float e = Object.new calls = [] calls << [2.0, e] calls << [e] assert_equal calls, Marshal.load(Marshal.dump(calls)) end When I run this test case, for some reason, the float takes the place of the object in the second array: [36/82] TestMarshal#test_marshal_object_and_float = 0.00 s 1) Failure: test_marshal_object_and_float(TestMarshal) [/Users/aaron/git/ruby/test/ruby/test_marshal.rb:40]: <[[2.0, #<Object:0x007fa5c20b08a0>], [#<Object:0x007fa5c20b08a0>]]> expected but was <[[2.0, #<Object:0x007fa5c20b05a8>], [2.0]]>. I've attached a failing test case.
on 2012-11-14 03:32
Issue #7348 has been updated by shyouhei (Shyouhei Urabe). Status changed from Open to Assigned Assignee set to ko1 (Koichi Sasada) ---------------------------------------- Bug #7348: marshaling an object by a float does not work https://bugs.ruby-lang.org/issues/7348#change-32886 Author: tenderlovemaking (Aaron Patterson) Status: Assigned Priority: Normal Assignee: ko1 (Koichi Sasada) Category: Target version: ruby -v: ruby 2.0.0dev (2012-11-14 trunk 37650) [x86_64-darwin12.2.1] The below `calls` object doesn't round trip through marshal on edge ruby: def test_marshal_object_and_float e = Object.new calls = [] calls << [2.0, e] calls << [e] assert_equal calls, Marshal.load(Marshal.dump(calls)) end When I run this test case, for some reason, the float takes the place of the object in the second array: [36/82] TestMarshal#test_marshal_object_and_float = 0.00 s 1) Failure: test_marshal_object_and_float(TestMarshal) [/Users/aaron/git/ruby/test/ruby/test_marshal.rb:40]: <[[2.0, #<Object:0x007fa5c20b08a0>], [#<Object:0x007fa5c20b08a0>]]> expected but was <[[2.0, #<Object:0x007fa5c20b05a8>], [2.0]]>. I've attached a failing test case.
on 2012-11-16 06:39
Issue #7348 has been updated by nagachika (Tomoyuki Chikanaga).
File flonum_marshal_dump.patch added
Category set to core
Assignee changed from ko1 (Koichi Sasada) to nagachika (Tomoyuki
Chikanaga)
Target version set to 2.0.0
hello,
I've investigated about this issue.
When flonum is introduced at r36798, flonum is treated as immediate
value in w_object(), but is should treated as reference value.
I will attach a patch. This patch introduce a trivial incompatibility.
All flonum of same value are dumped as reference of same Float object. I
don't think this is not a practical problem.
(on flonum supported environment)
a = [2.0, 2.0, 2.0]
File.write("dump.txt", Marshal.dump(a))
(on flonum not supported environment)
a = Marshal.load(File.read("dump.txt"))
a.map{|f| f.object_id} # => [70180445290980, 70180445290980,
70180445290980]
If there's no objection, I'll check-in it tonight (in JST).
----------------------------------------
Bug #7348: marshaling an object by a float does not work
https://bugs.ruby-lang.org/issues/7348#change-32953
Author: tenderlovemaking (Aaron Patterson)
Status: Assigned
Priority: Normal
Assignee: nagachika (Tomoyuki Chikanaga)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-14 trunk 37650) [x86_64-darwin12.2.1]
The below `calls` object doesn't round trip through marshal on edge
ruby:
def test_marshal_object_and_float
e = Object.new
calls = []
calls << [2.0, e]
calls << [e]
assert_equal calls, Marshal.load(Marshal.dump(calls))
end
When I run this test case, for some reason, the float takes the place of
the object in the second array:
[36/82] TestMarshal#test_marshal_object_and_float = 0.00 s
1) Failure:
test_marshal_object_and_float(TestMarshal)
[/Users/aaron/git/ruby/test/ruby/test_marshal.rb:40]:
<[[2.0, #<Object:0x007fa5c20b08a0>], [#<Object:0x007fa5c20b08a0>]]>
expected but was
<[[2.0, #<Object:0x007fa5c20b05a8>], [2.0]]>.
I've attached a failing test case.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.