mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* rational.c (string_to_r): Rational#** may return flonum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
27f4e21824
commit
aca87391e9
2 changed files with 11 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Jun 10 00:24:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* rational.c (string_to_r): Rational#** may return flonum.
|
||||
|
||||
Thu Jun 9 23:57:53 2011 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* io.c: fix IO.copy_stream interrupt handling.
|
||||
|
|
10
rational.c
10
rational.c
|
@ -2152,7 +2152,7 @@ string_to_r_strict(VALUE self)
|
|||
static VALUE
|
||||
string_to_r(VALUE self)
|
||||
{
|
||||
VALUE s, a, backref;
|
||||
VALUE s, a, a1, backref;
|
||||
|
||||
backref = rb_backref_get();
|
||||
rb_match_busy(backref);
|
||||
|
@ -2162,8 +2162,12 @@ string_to_r(VALUE self)
|
|||
|
||||
rb_backref_set(backref);
|
||||
|
||||
if (!NIL_P(RARRAY_PTR(a)[0]))
|
||||
return RARRAY_PTR(a)[0];
|
||||
a1 = RARRAY_PTR(a)[0];
|
||||
if (!NIL_P(a1)) {
|
||||
if (TYPE(a1) == T_FLOAT)
|
||||
rb_raise(rb_eFloatDomainError, "Infinity");
|
||||
return a1;
|
||||
}
|
||||
return rb_rational_new1(INT2FIX(0));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue