[#67346] Future of test suites for Ruby — Charles Oliver Nutter <headius@...>

I'll try to be brief so we can discuss all this. tl;dr: RubySpec is

19 messages 2015/01/05

[ruby-core:67408] Re: [ruby-trunk - Bug #10711] [Open] Incorrect error message in coerce failed

From: Eric Wong <normalperson@...>
Date: 2015-01-07 21:41:52 UTC
List: ruby-core #67408
do_coerce modifies x, so stashing the original before seems to fix
the problem.  Maybe I missed something else.  Lightly-tested patch:

--- a/numeric.c
+++ b/numeric.c
@@ -3426,10 +3426,11 @@ static int
 bit_coerce(VALUE *x, VALUE *y)
 {
     if (!FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) {
+	VALUE orig = *x;
 	do_coerce(x, y, TRUE);
 	if (!FIXNUM_P(*x) && !RB_TYPE_P(*x, T_BIGNUM)
 	    && !FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) {
-	    coerce_failed(*x, *y);
+	    coerce_failed(orig, *y);
 	}
     }
     return TRUE;

In This Thread

Prev Next