Backport #8357

Module#prepend breaks comparison operator

Added by Alex Goldsmith 12 months ago. Updated 12 months 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 40575
Added by Tomoyuki Chikanaga 12 months 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 12 months 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 12 months ago

  • Assignee set to Nobuyoshi Nakada

#3 Updated by Nobuyoshi Nakada 12 months 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 (rbobjiskindof): skip prepending modules. [Bug #8357]
  • object.c (rbclassinherited_p): ditto. [Bug #8357]

#4 Updated by Tomoyuki Chikanaga 12 months 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 12 months 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