1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix a wrong lineno in backtrace for cfunc

lineno is an int, and INT2FIX(0) was assigned.

[Bug #15719] [ruby-core:91911]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2019-03-21 05:59:14 +00:00
parent b8540a3c2e
commit e1038377a9
2 changed files with 15 additions and 1 deletions

View file

@ -329,4 +329,18 @@ class TestBacktrace < Test::Unit::TestCase
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

View file

@ -352,7 +352,7 @@ location_to_str(rb_backtrace_location_t *loc)
}
else {
file = GET_VM()->progname;
lineno = INT2FIX(0);
lineno = 0;
}
name = rb_id2str(loc->body.cfunc.mid);
break;