From c05d019cb4778ac04088df69541aab0762d849f8 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 9 Oct 2013 16:36:05 +0000 Subject: merge revision(s) 43208: [Backport #9003] * compar.c (cmp_eq): fail if recursion. [ruby-core:57736] [Bug #9003] * thread.c (rb_exec_recursive_paired_outer): new function which is combinnation of paired and outer variants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@43230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compar.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'compar.c') diff --git a/compar.c b/compar.c index c89c752daf..fc04946e3f 100644 --- a/compar.c +++ b/compar.c @@ -51,10 +51,17 @@ rb_invcmp(VALUE x, VALUE y) } } +static VALUE +cmp_eq_recursive(VALUE arg1, VALUE arg2, int recursive) +{ + if (recursive) return Qfalse; + return rb_funcall(arg1, cmp, 1, arg2); +} + static VALUE cmp_eq(VALUE *a) { - VALUE c = rb_funcall(a[0], cmp, 1, a[1]); + VALUE c = rb_exec_recursive_paired_outer(cmp_eq_recursive, a[0], a[1], a[1]); if (NIL_P(c)) return Qfalse; if (rb_cmpint(c, a[0], a[1]) == 0) return Qtrue; -- cgit v1.2.3