ruby-changes:44533
From: nobu <ko1@a...>
Date: Sun, 6 Nov 2016 00:45:46 +0900 (JST)
Subject: [ruby-changes:44533] nobu:r56606 (trunk): numeric.c: raise TypeError at wrong argument
nobu 2016-11-06 00:45:42 +0900 (Sun, 06 Nov 2016) New Revision: 56606 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56606 Log: 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. Modified files: trunk/numeric.c Index: numeric.c =================================================================== --- numeric.c (revision 56605) +++ numeric.c (revision 56606) @@ -274,7 +274,7 @@ int_pos_p(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L274 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) https://github.com/ruby/ruby/blob/trunk/numeric.c#L286 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/