[#92063] [Ruby trunk Misc#15723] Reconsider numbered parameters — zverok.offline@...
Issue #15723 has been updated by zverok (Victor Shepelev).
3 messages
2019/03/31
[ruby-core:91911] [Ruby trunk Bug#15719] to_enum を使用した場合にバックトレースが意図しないものになる
From:
krororo.07@...
Date:
2019-03-21 03:13:43 UTC
List:
ruby-core #91911
Issue #15719 has been reported by krororo (Ryota Kitazawa). ---------------------------------------- Bug #15719: to_enum を使用した場合にバックトレースが意図しないものになる https://bugs.ruby-lang.org/issues/15719 * Author: krororo (Ryota Kitazawa) * Status: Open * 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>