Actions
Bug #14658
closedKernel#singleton_method is incompatible with Module#prepend.
Description
It's not possible to get singleton method using Kernel#singleton_method if singleton class was prepended with any module:
module Empty; end
class MyClass
singleton_class.prepend(Empty)
def self.foo; end
end
MyClass.singleton_methods(false) # => [:foo]
MyClass.singleton_method(:foo) # => NameError (undefined singleton method `foo' for `MyClass')
Attached patch fixes it.
Files
Updated by nashby (Vasiliy Ermolovich) over 6 years ago
Updated by nobu (Nobuyoshi Nakada) over 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r63067.
Fix Kernel#singleton_method with Module#Prepend
- proc.c (rb_obj_singleton_method): search the method entry from
the origin class, for fix prepended modules. [Bug #14658]
From: Vasiliy Ermolovich younash@gmail.com
Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) about 6 years ago
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: REQUIRED to 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: DONE
ruby_2_5 r64981 merged revision(s) 63067,63068.
Updated by usa (Usaku NAKAMURA) about 6 years ago
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: DONE to 2.3: UNKNOWN, 2.4: DONE, 2.5: DONE
ruby_2_4 r65118 merged revision(s) 63067,63068.
Actions
Like0
Like0Like0Like0Like0Like0