summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-10-11 13:36:25 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-10-26 08:47:33 +0100
commitcffdacb15a363321e1c1879aa7d94924acafd1cf (patch)
tree0f5a99285c282368c929b75f5d5e47d5933863b1 /error.c
parentfbb2d30ee69c68ffad6287c12ca5a43753cd1b9a (diff)
Ignore <internal: entries from core library methods for Kernel#warn(message, uplevel: n)
* Fixes [Bug #17259]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3647
Diffstat (limited to 'error.c')
-rw-r--r--error.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/error.c b/error.c
index d58075f4b5..2e02fbf9b4 100644
--- a/error.c
+++ b/error.c
@@ -504,7 +504,8 @@ warning_write(int argc, VALUE *argv, VALUE buf)
return buf;
}
-VALUE rb_ec_backtrace_location_ary(rb_execution_context_t *ec, long lev, long n);
+VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n, bool skip_internal);
+
static VALUE
rb_warn_m(rb_execution_context_t *ec, VALUE exc, VALUE msgs, VALUE uplevel, VALUE category)
{
@@ -519,7 +520,7 @@ rb_warn_m(rb_execution_context_t *ec, VALUE exc, VALUE msgs, VALUE uplevel, VALU
if (lev < 0) {
rb_raise(rb_eArgError, "negative level (%ld)", lev);
}
- location = rb_ec_backtrace_location_ary(ec, lev + 1, 1);
+ location = rb_ec_backtrace_location_ary(ec, lev + 1, 1, TRUE);
if (!NIL_P(location)) {
location = rb_ary_entry(location, 0);
}