Issue #9380 has been updated by Yui NARUSE.

Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE

----------------------------------------
Bug #9380: Enumerator does not work in timeout
https://bugs.ruby-lang.org/issues/9380#change-45289

* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: lib
* Target version: current: 2.2.0
* ruby -v: r44522
* Backport: 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE
----------------------------------------
`Enumerator`と`timeout`の組み合わせで、`Timeout::Error`が起きるべきところで`ArgumentError`が発生します。

```
$ ruby -v -rtimeout -e 'def (o=Object.new).each; sleep; end' -e 'Timeout.timeout(0.01) {o.to_enum.next}'
ruby 2.2.0dev (2014-01-07 trunk 44522) [universal.x86_64-darwin13.0]
/opt/local/lib/ruby/2.2.0/timeout.rb:39:in `throw': uncaught throw #<Timeout::ExitException: Timeout::ExitException> (ArgumentError)
	from /opt/local/lib/ruby/2.2.0/timeout.rb:39:in `exception'
	from -e:1:in `sleep'
	from -e:1:in `each'
	from -e:1:in `each'
```




-- 
http://bugs.ruby-lang.org/