diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | rational.c | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Tue Jun 13 17:06:20 2008 wanabe <s.wanabe@gmail.com> + + * rational.c (string_to_r_internal): save and restore backref. + fixed [ruby-dev:34990] + Fri Jun 13 14:41:26 2008 NAKAMURA Usaku <usa@ruby-lang.org> * README.EXT.ja: update about Fixnum. reported in diff --git a/rational.c b/rational.c index db962451d7..53e5fd4aeb 100644 --- a/rational.c +++ b/rational.c @@ -1274,13 +1274,15 @@ make_patterns(void) static VALUE string_to_r_internal(VALUE self) { - VALUE s, m; + VALUE s, m, backref; s = f_strip(self); if (RSTRING_LEN(s) == 0) return rb_assoc_new(Qnil, self); + backref = rb_backref_get(); + rb_match_busy(backref); m = f_match(rat_pat, s); if (!NIL_P(m)) { @@ -1333,8 +1335,10 @@ string_to_r_internal(VALUE self) if (!NIL_P(de)) v = f_div(v, f_to_i(de)); + rb_backref_set(backref); return rb_assoc_new(v, re); } + rb_backref_set(backref); return rb_assoc_new(Qnil, self); } |