[ruby-core:93610] [Ruby master Bug#10635] cmp_failed warnings in 2.2 are very hard to track down

From: merch-redmine@...
Date: 2019-07-08 03:54:28 UTC
List: ruby-core #93610
Issue #10635 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

`cmp_failed` was removed in Ruby 2.3.

----------------------------------------
Bug #10635: cmp_failed warnings in 2.2 are very hard to track down
https://bugs.ruby-lang.org/issues/10635#change-79208

* Author: tmm1 (Aman Gupta)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.2.0dev
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
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



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next