Actions
Bug #2945
closedRegexp#=== is failed by an exception when the exception is occurred in method_missing
Description
=begin
When an exception is occurred in method_missing,
Regexp#=== is failed by the exception.
Is this valid behavior?
o = Object.new
class <<
def method_missing(m, *args)
raise "XXX" if m == :to_str
end
end
/aaa/ === o # =:> `method_missing': XXX (RuntimeError)
If correct this, apply the following patch.
diff --git a/re.c b/re.c
index 6ec3646..8a38155 100644
--- a/re.c
+++ b/re.c
@@ -2685,6 +2685,12 @@ rb_reg_match(VALUE re, VALUE str)
return LONG2FIX(pos);
}
+static VALUE
+reg_check_operand(VALUE str)
+{
- return reg_operand(str, FALSE);
+}
/*
- call-seq:
-
rxp === str => true or false
@@ -2708,7 +2714,7 @@ rb_reg_eqq(VALUE re, VALUE str)
{
long start;
- str = reg_operand(str, FALSE);
- str = rb_protect(reg_check_operand, str, 0);
if (NIL_P(str)) {
rb_backref_set(Qnil);
return Qfalse;
=end
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0