6b1add1e70 (master): Fix Array#sum when init is float but array contains non-float

0 views
Skip to first unread message

Peter Zhu

unread,
9:57 AM (8 hours ago) 9:57 AM
to ruby...@g.ruby-lang.org
Peter Zhu 2026-10-06 13:08:25 +0000 (Tue, 06 Oct 2026)

New Revision: 6b1add1e70

https://github.com/ruby/ruby/commit/6b1add1e70

Log:
Fix Array#sum when init is float but array contains non-float

If the initial value is a float but an element of the array is not a float,
then it could be lost and an error won't be raised. For example, the following
code should raise a TypeError but currently does not:

["hello"].sum(10.0)

Modified files:
array.c
test/ruby/test_array.rb
Reply all
Reply to author
Forward
0 new messages