summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-18 04:19:32 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-18 04:19:32 +0000
commit283b3d8f99c01a13e727b2edf0a7643a67d16361 (patch)
treef1e2753826bda61aa0e0f259163dd0641c813434 /object.c
parentb9289589d66efec4a5953e8a964019201aaeca9e (diff)
merge revision(s) 66796,66797: [Backport #15525]
No TypeError at nil if exception: false [ruby-core:91021] [Bug #15525] No FloatDomainError at non-finitive number if exception: false [ruby-core:91021] [Bug #15525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/object.c b/object.c
index a60626b5a1..1c0ddfb356 100644
--- a/object.c
+++ b/object.c
@@ -3159,6 +3159,7 @@ rb_convert_to_integer(VALUE val, int base, int raise_exception)
double f;
if (base != 0) goto arg_error;
f = RFLOAT_VALUE(val);
+ if (!raise_exception && !isfinite(f)) return Qnil;
if (FIXABLE(f)) return LONG2FIX((long)f);
return rb_dbl2big(f);
}