diff options
author | Kenichi Kamiya <[email protected]> | 2019-11-02 00:54:36 +0900 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2019-11-03 11:03:04 +0100 |
commit | 452bee3ee8d68059fabd9b1c7a75661b14e3933e (patch) | |
tree | d0d6abd12e989242a1e70d2864682f39b7efde45 /re.c | |
parent | 772b0613c583773cd2eda23bce8275926a351e79 (diff) |
Revert nil error and adding deprecation message
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2637
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -3323,7 +3323,9 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re) pos = 0; } - str = SYMBOL_P(str) ? rb_sym2str(str) : StringValue(str); + if (NIL_P(str)) { + rb_warn("given argument is nil"); + } pos = reg_match_pos(re, &str, pos); if (pos < 0) { rb_backref_set(Qnil); @@ -3369,6 +3371,10 @@ rb_reg_match_p(VALUE re, VALUE str, long pos) const UChar *start, *end; int tmpreg; + if (NIL_P(str)) { + rb_warn("given argument is nil"); + return Qfalse; + } str = SYMBOL_P(str) ? rb_sym2str(str) : StringValue(str); if (pos) { if (pos < 0) { |