Skip to content

Commit

Permalink
Fix bug that disallowed methods from singleton classes to be used fo…
Browse files Browse the repository at this point in the history
…r UnboundMethod#bind, Kernel#define_singleton_method and Module#define_method, even when that singleton class was of the right kind_of.
  • Loading branch information
Watson1978 committed Jan 5, 2012
1 parent 4665130 commit 8ad516a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions proc.c
Expand Up @@ -1213,12 +1213,12 @@ umethod_bind(VALUE method, SEL sel, VALUE recv)
rb_vm_method_t *data, *bound;

Data_Get_Struct(method, rb_vm_method_t, data);
if (data->rclass != CLASS_OF(recv)) {
if (data->rclass != CLASS_OF(recv) && !rb_obj_is_kind_of(recv, data->rclass)) {
if (RCLASS_SINGLETON(data->rclass)) {
rb_raise(rb_eTypeError,
"singleton method called for a different object");
}
if (!rb_obj_is_kind_of(recv, data->rclass)) {
else {
rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
rb_class2name(data->rclass));
}
Expand Down

0 comments on commit 8ad516a

Please sign in to comment.