Actions
Bug #14552
closedKernel#Integer can return a non-Integer object.
Description
I found a bug that Kernel#Integer returns any non-nil object which is a result of to_int.
obj = Object.new
def obj.to_int
"str"
end
Integer(obj) #=> "str"
Updated by mrkn (Kenta Murata) over 6 years ago
- Status changed from Assigned to Closed
Applied in changeset trunk|r62581.
Check the result of to_int in Kernel#Integer
[ruby-core:85813] [Bug #14552]
-
object.c (rb_convert_to_integer):
Check the result of to_int in Kernel#Integer -
test/ruby/test_integer.rb: add tests.
-
spec/ruby/core/kernel/Integer_spec.rb: fix examples.
Actions
Like0
Like0