aboutsummaryrefslogtreecommitdiffstats
path: root/range.c
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2020-10-20 16:00:35 +0900
committerKenta Murata <mrkn@mrkn.jp>2020-10-20 16:01:57 +0900
commit18cecda46e427362fa3447679e5d8a917b5d6cb6 (patch)
tree467a219e1132d554205b784a58b4137615813e9c /range.c
parentade411465dc054af5ff025531649b69134d74b56 (diff)
downloadruby-18cecda46e427362fa3447679e5d8a917b5d6cb6.tar.gz
range.c: Fix an exception message in rb_range_beg_len
[Bug #17271]
Diffstat (limited to 'range.c')
-rw-r--r--range.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/range.c b/range.c
index 17d29925f1..c019fcf2e0 100644
--- a/range.c
+++ b/range.c
@@ -1332,7 +1332,7 @@ rb_range_values(VALUE range, VALUE *begp, VALUE *endp, int *exclp)
VALUE
rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
{
- long beg, end, origbeg, origend;
+ long beg, end;
VALUE b, e;
int excl;
@@ -1341,8 +1341,6 @@ rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
beg = NIL_P(b) ? 0 : NUM2LONG(b);
end = NIL_P(e) ? -1 : NUM2LONG(e);
if (NIL_P(e)) excl = 0;
- origbeg = beg;
- origend = end;
if (beg < 0) {
beg += len;
if (beg < 0)
@@ -1368,8 +1366,7 @@ rb_range_beg_len(VALUE range, long *begp, long *lenp, long len, int err)
out_of_range:
if (err) {
- rb_raise(rb_eRangeError, "%ld..%s%ld out of range",
- origbeg, excl ? "." : "", origend);
+ rb_raise(rb_eRangeError, "%+"PRIsVALUE" out of range", range);
}
return Qnil;
}