From: mame@... Date: 2019-03-21T06:04:31+00:00 Subject: [ruby-core:91913] [Ruby trunk Bug#15719] to_enum を使用した場合にバックトレースが意図しないものになる Issue #15719 has been updated by mame (Yusuke Endoh). ������������������������������������������������������������������������������������������������������������ ``` $ ./miniruby /tmp/test.rb Traceback (most recent call last): 1: from /tmp/test.rb:in `each' /tmp/test.rb:3:in `foo': error! (RuntimeError) ``` ��������������������������������������������������������������� ---------------------------------------- Bug #15719: to_enum ������������������������������������������������������������������������������ https://bugs.ruby-lang.org/issues/15719#change-77242 * Author: krororo (Ryota Kitazawa) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- to_enum ���������������������������������������������������������������������������������1������ each ������������������������ ������������������ 8 ������������to_enum ��������������� foo ������������������������������������������������������������������������������ ### ��������������� ```ruby def foo return to_enum(__method__) unless block_given? raise 'error!' yield 1 end enum = foo p enum.next ``` ### ������������ ``` $ ruby /tmp/test.rb Traceback (most recent call last): 1: from /tmp/test.rb:1:in `each' /tmp/test.rb:3:in `foo': error! (RuntimeError) ``` see: https://github.com/ruby/csv/issues/82 -- https://bugs.ruby-lang.org/ Unsubscribe: