ruby-changes:55119
From: mame <ko1@a...>
Date: Thu, 21 Mar 2019 14:59:19 +0900 (JST)
Subject: [ruby-changes:55119] mame:r67326 (trunk): Fix a wrong lineno in backtrace for cfunc
mame 2019-03-21 14:59:14 +0900 (Thu, 21 Mar 2019) New Revision: 67326 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67326 Log: Fix a wrong lineno in backtrace for cfunc lineno is an int, and INT2FIX(0) was assigned. [Bug #15719] [ruby-core:91911] Modified files: trunk/test/ruby/test_backtrace.rb trunk/vm_backtrace.c Index: vm_backtrace.c =================================================================== --- vm_backtrace.c (revision 67325) +++ vm_backtrace.c (revision 67326) @@ -352,7 +352,7 @@ location_to_str(rb_backtrace_location_t https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L352 } else { file = GET_VM()->progname; - lineno = INT2FIX(0); + lineno = 0; } name = rb_id2str(loc->body.cfunc.mid); break; Index: test/ruby/test_backtrace.rb =================================================================== --- test/ruby/test_backtrace.rb (revision 67325) +++ test/ruby/test_backtrace.rb (revision 67326) @@ -329,4 +329,18 @@ class TestBacktrace < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/ruby/test_backtrace.rb#L329 bar end; end + + def test_caller_to_enum + err = ["-:3:in `foo': unhandled exception", "\tfrom -:in `each'"] + assert_in_out_err([], <<-"end;", [], err, "[ruby-core:91911]") + def foo + return to_enum(__method__) unless block_given? + raise + yield 1 + end + + enum = foo + enum.next + end; + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/