Project

General

Profile

Actions

Bug #10635

closed

cmp_failed warnings in 2.2 are very hard to track down

Added by tmm1 (Aman Karmani) over 9 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0dev
[ruby-core:67055]

Description

I propose we add the exception (and possibly backtrace as well) to show the root cause of the warning.

diff --git a/compar.c b/compar.c
index 81dff38..70d08ca 100644
--- a/compar.c
+++ b/compar.c
@@ -68,10 +68,11 @@ cmp_eq(VALUE *a)
 }
 
 static VALUE
-cmp_failed(void)
+cmp_failed(VALUE args, VALUE exception_object)
 {
     rb_warn("Comparable#== will no more rescue exceptions of #<=> in the next release.");
     rb_warn("Return nil in #<=> if the comparison is inappropriate or avoid such comparison.");
+    rb_warn("Exception: %"PRIsVALUE, rb_inspect(exception_object));
     return Qfalse;
 }
 

cc #7688

Actions #1

Updated by naruse (Yui NARUSE) over 6 years ago

  • Target version deleted (2.2.0)

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

  • Status changed from Open to Closed

cmp_failed was removed in Ruby 2.3.

Actions

Also available in: Atom PDF

Like0
Like0Like0