From 04ff7cf7120777bc703f674045bd9d1c1ac99e0c Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 5 Nov 2016 15:45:42 +0000 Subject: [PATCH] numeric.c: raise TypeError at wrong argument * numeric.c (int_pos_p, int_neg_p): raise TypeError if not an Integer instead of returning nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numeric.c b/numeric.c index e7a98566c0..3620f1f3b8 100644 --- a/numeric.c +++ b/numeric.c @@ -274,7 +274,7 @@ int_pos_p(VALUE num) else if (RB_TYPE_P(num, T_BIGNUM)) { return BIGNUM_POSITIVE_P(num); } - return Qnil; + rb_raise(rb_eTypeError, "not an Integer"); } static inline int @@ -286,7 +286,7 @@ int_neg_p(VALUE num) else if (RB_TYPE_P(num, T_BIGNUM)) { return BIGNUM_NEGATIVE_P(num); } - return Qnil; + rb_raise(rb_eTypeError, "not an Integer"); } static inline int