Project

General

Profile

Bug #15501

private_methods(false) changes behavior based on singleton class allocation

Added by kddeisz (Kevin Deisz) 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:90872]

Description

class Module
  prepend Module.new
end

module Foo
end

p Foo.private_methods(false)
# => [:remove_const, :method_added, :method_removed, :method_undefined, :prepend_features, :extend_object, :refine, :using, :append_features, :initialize, :initialize_clone, :initialize_copy, :public, :private, :module_function, :protected, :included, :extended, :prepended]

Foo.singleton_class

p Foo.private_methods(false)
# => []

I have no idea what is causing this, but I tested it and it looks like this goes back to at least 2.1.5. It looks like before the singleton class is allocated private_methods(false) returns a whole host of methods, while after it returns the expected output. Any help/advice would be appreciated.

Associated revisions

Revision 140f8b94
Added by nobu (Nobuyoshi Nakada) 5 months ago

class.c: refactor class_instance_method_list

  • class.c (class_instance_method_list): gather singleton and extended methods first separately from ancestors. [ruby-core:90872] [Bug #15501]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 66764
Added by nobu (Nobuyoshi Nakada) 5 months ago

class.c: refactor class_instance_method_list

  • class.c (class_instance_method_list): gather singleton and extended methods first separately from ancestors. [ruby-core:90872] [Bug #15501]

History

Updated by marcandre (Marc-Andre Lafortune) 6 months ago

  • Assignee set to nobu (Nobuyoshi Nakada)

Good catch.

#2

Updated by nobu (Nobuyoshi Nakada) 5 months ago

  • Status changed from Open to Closed

Applied in changeset trunk|r66764.


class.c: refactor class_instance_method_list

  • class.c (class_instance_method_list): gather singleton and extended methods first separately from ancestors. [ruby-core:90872] [Bug #15501]

Also available in: Atom PDF