Backport #8357

Module#prepend breaks comparison operator

Added by Alex Goldsmith about 2 years ago. Updated about 2 years ago.

[ruby-core:54736]
Status:Closed
Priority:Urgent
Assignee:Tomoyuki Chikanaga

Description

Array < Enumerable # => true
Enumerable.send :prepend, Module.new
Array < Enumerable # => nil
Array.ancestors.include? Enumerable # => true

Same thing happens in 2.0.0-p0.

Possibly similar to what's happening in: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/53106

Associated revisions

Revision 40561
Added by Nobuyoshi Nakada about 2 years ago

object.c: skip prepending modules

  • object.c (rb_obj_is_kind_of): skip prepending modules. [Bug #8357]
  • object.c (rb_class_inherited_p): ditto. [Bug #8357]

Revision 40575
Added by Tomoyuki Chikanaga about 2 years ago

merge revision(s) 40561: [Backport #8357]

* object.c (rb_obj_is_kind_of): skip prepending modules.
   [Bug #8357]

* object.c (rb_class_inherited_p): ditto.
   [Bug #8357]

History

#1 Updated by Marc-Andre Lafortune about 2 years ago

  • Priority changed from Normal to Urgent

Ouch.

=== is also broken:

Enumerable.send :prepend, Module.new
Enumerable === [] # => false, should be true

#2 Updated by Marc-Andre Lafortune about 2 years ago

  • Assignee set to Nobuyoshi Nakada

#3 Updated by Nobuyoshi Nakada about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40561.
Alex, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


object.c: skip prepending modules

  • object.c (rb_obj_is_kind_of): skip prepending modules. [Bug #8357]
  • object.c (rb_class_inherited_p): ditto. [Bug #8357]

#4 Updated by Tomoyuki Chikanaga about 2 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby trunk to Backport200
  • Status changed from Closed to Assigned
  • Assignee changed from Nobuyoshi Nakada to Tomoyuki Chikanaga

#5 Updated by Tomoyuki Chikanaga about 2 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r40575.
Alex, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 40561: [Backport #8357]

* object.c (rb_obj_is_kind_of): skip prepending modules.
   [Bug #8357]

* object.c (rb_class_inherited_p): ditto.
   [Bug #8357]

Also available in: Atom PDF