Actions
Bug #10167
closedPrime#include?(mod) hangs up
Description
We expect Prime
class implements Module#include?(mod)
. But Prime#include?(mod)
hangs up, because it is overwritten by Enumerable#include?(obj)
and tries to search mod
linearly from infinite sequence of prime numbers.
Reproducible script:
$ ruby -e 'require "prime"; puts Prime.include?(Enumerable)'
- Expected: returns
true
- Actual: hangs up
I found this bug by the following code (hangs up if prime is required)
enumerables = []
ObjectSpace.each_object(Class){|klass|
if klass.include?(Enumerable) then
enumerables.push klass
end
}
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0