diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-11-19 10:40:07 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-11-19 10:57:07 +0900 |
| commit | 0a0cc5a217b577dfadddfb250d5a91ca69978887 (patch) | |
| tree | d3c99a1024991bc0569539ea7198fe8f0cdcfd70 /mrbgems/mruby-enum-lazy | |
| parent | 31a961acf16b7a9454ccb0f0ece91b79e95f7078 (diff) | |
| download | mruby-0a0cc5a217b577dfadddfb250d5a91ca69978887.tar.gz mruby-0a0cc5a217b577dfadddfb250d5a91ca69978887.zip | |
Check method existence for Enumerators; fix #3920
The issue #3920 was fixed but the fundamental flaw of lack of stack
depth check along with fibers still remains, even though it's not
easy to cause the issue. Use `MRB_GC_FIXED_ARENA` to avoid the issue
for workaround.
After this patch, `obj.to_enum` raises `ArgumentError` if the object
does not respond to the enumerating method. This is incompatible to
CRuby but I think this behavior is better and CRuby should be updated
to behave like this.
Diffstat (limited to 'mrbgems/mruby-enum-lazy')
| -rw-r--r-- | mrbgems/mruby-enum-lazy/mrblib/lazy.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb index 9227abe8a..e4f116a93 100644 --- a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb +++ b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb @@ -44,7 +44,7 @@ class Enumerator def to_enum(meth=:each, *args, &block) unless self.respond_to?(meth) - raise NoMethodError, "undefined method #{meth}" + raise ArgumentError, "undefined method #{meth}" end lz = Lazy.new(self, &block) lz.obj = self |
