diff --git a/ChangeLog b/ChangeLog index 6bb07bb370..a2278ec6b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Aug 23 20:34:32 2012 NAKAMURA Usaku + + * class.c (singleton_class_of): flonum can't have singleton class. + + * vm.c (vm_define_method): flonum can't have singleton method. + Thu Aug 23 19:18:33 2012 NAKAMURA Usaku * common.mk (win32/*): macro RUBY_H_INCLUDES is not defined there, diff --git a/class.c b/class.c index 2ee5b8867a..1d871fb7ee 100644 --- a/class.c +++ b/class.c @@ -1315,7 +1315,7 @@ singleton_class_of(VALUE obj) { VALUE klass; - if (FIXNUM_P(obj) || SYMBOL_P(obj)) { + if (FIXNUM_P(obj) || FLONUM_P(obj) || SYMBOL_P(obj)) { rb_raise(rb_eTypeError, "can't define singleton"); } if (SPECIAL_CONST_P(obj)) { diff --git a/vm.c b/vm.c index ed4d31e95f..55ccfe7939 100644 --- a/vm.c +++ b/vm.c @@ -1857,7 +1857,7 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval, } if (is_singleton) { - if (FIXNUM_P(obj) || SYMBOL_P(obj)) { + if (FIXNUM_P(obj) || FLONUM_P(obj) || SYMBOL_P(obj)) { rb_raise(rb_eTypeError, "can't define singleton method \"%s\" for %s", rb_id2name(id), rb_obj_classname(obj));