diff --git a/ChangeLog b/ChangeLog index a9032efddc..024ee25ca7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 12 23:30:26 2009 Nobuyoshi Nakada + + * object.c (rb_to_integer, rb_check_to_integer): return Bignum + as-is. + Sun Jul 12 21:07:46 2009 Tadayoshi Funaba * complex.c: use k_exact_{zero,one}_p macro. diff --git a/object.c b/object.c index 2df7239f18..d86c6e49d4 100644 --- a/object.c +++ b/object.c @@ -2057,6 +2057,7 @@ rb_to_integer(VALUE val, const char *method) VALUE v; if (FIXNUM_P(val)) return val; + if (TYPE(val) == T_BIGNUM) return val; v = convert_type(val, "Integer", method, Qtrue); if (!rb_obj_is_kind_of(v, rb_cInteger)) { const char *cname = rb_obj_classname(val); @@ -2072,6 +2073,7 @@ rb_check_to_integer(VALUE val, const char *method) VALUE v; if (FIXNUM_P(val)) return val; + if (TYPE(val) == T_BIGNUM) return val; v = convert_type(val, "Integer", method, Qfalse); if (!rb_obj_is_kind_of(v, rb_cInteger)) { return Qnil;