From: ko1@... Date: 2015-12-21T10:34:23+00:00 Subject: [ruby-core:72420] [Ruby trunk - Bug #11740] [Assigned] ObjectSpace.each_object exposes internal metaclasses Issue #11740 has been updated by Koichi Sasada. Status changed from Closed to Assigned This patch breaks rubyspec. ``` 1) ObjectSpace.each_object walks a class and its normal descendants when passed the class's singleton class FAILED Expected [#, #, #, #] to equal [#:0x00000001860d20>>, #, #, #, #] /mnt/sdb1/ruby/trunk/spec/rubyspec/core/objectspace/each_object_spec.rb:222:in `block (2 levels) in ' /mnt/sdb1/ruby/trunk/spec/rubyspec/core/objectspace/each_object_spec.rb:4:in `' 2) ObjectSpace.each_object on singleton classes walks singleton classes FAILED Expected [#] ``` Maybe I missed some points. Any idea? ---------------------------------------- Bug #11740: ObjectSpace.each_object exposes internal metaclasses https://bugs.ruby-lang.org/issues/11740#change-55710 * Author: Benoit Daloze * Status: Assigned * Priority: Normal * Assignee: Koichi Sasada * ruby -v: ruby 2.3.0dev (2015-11-19 trunk 52672) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- ObjectSpace.each_object exposes internal metaclasses and this might result in assumptions being violated since the metaclass structure is not well preserved. See the attached script for an example. The #bla method should always be defined on the metaclass of "klass". See https://bugs.ruby-lang.org/issues/11360#note-2 as well in which I warned against this problem ;) ---Files-------------------------------- objspace_expose_intern_meta.rb (413 Bytes) -- https://bugs.ruby-lang.org/