Actions
Bug #18236
closedConversion to float not working for object with to_f method
Description
Following code works on all previous versions (1.8.7-p375, 1.9.3-p551, 2.0.0-p648, 2.1.10, 2.2.10, 2.4.10, 2.5.9, 2.6.8, 2.7.4), but not on 3.0 versions (3.0.0, 3.0.1, 3.0.2).
class Something
def to_f
0.1
end
end
Thread.new{ }.join(Something.new)
On 3.0 it fails with:
test.rb:7:in `join': can't convert Something into Float (TypeError)
from test.rb:7:in `<main>'
Thread#join
uses rb_to_float
which should handle object with to_f
method (1, 2).
Discovered when digging into a PR submitted by @yahonda (Yasuo Honda)
Updated by nobu (Nobuyoshi Nakada) about 3 years ago
- Status changed from Open to Closed
Applied in changeset git|19f9d9cf739e7fc185ef90d5da5b4b12cf902a52.
Remove extraneous conversion to float [Bug #18236]
Updated by hsbt (Hiroshi SHIBATA) over 1 year ago
- Backport changed from 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.7: DONTNEED, 3.0: REQUIRED, 3.1: DONTNEED, 3.2: DONTNEED
Actions
Like0
Like0Like0