[前][次][番号順一覧][スレッド一覧]

ruby-changes:64807

From: Kenta <ko1@a...>
Date: Sat, 9 Jan 2021 22:07:07 +0900 (JST)
Subject: [ruby-changes:64807] be34e31d8e (master): [ruby/bigdecimal] Add assertions for checking the argument types

https://git.ruby-lang.org/ruby.git/commit/?id=be34e31d8e

From be34e31d8e68b365a104c955389c6e9f865e054e Mon Sep 17 00:00:00 2001
From: Kenta Murata <mrkn@m...>
Date: Sat, 9 Jan 2021 15:19:52 +0900
Subject: [ruby/bigdecimal] Add assertions for checking the argument types

https://github.com/ruby/bigdecimal/commit/96c9ebd886

diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 5194615..ef17882 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -2799,6 +2799,8 @@ static VALUE rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2799
 static VALUE
 rb_float_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
 {
+    assert(RB_FLOAT_TYPE_P(val));
+
     double d = RFLOAT_VALUE(val);
 
     if (!isfinite(d)) {
@@ -2838,6 +2840,8 @@ rb_float_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2840
 static VALUE
 rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
 {
+    assert(RB_TYPE_P(val, T_RATIONAL));
+
     if (digs == SIZE_MAX) {
         if (!raise_exception)
             return Qnil;
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]