Project

General

Profile

Actions

Bug #11740

closed

ObjectSpace.each_object exposes internal metaclasses

Added by Eregon (Benoit Daloze) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-11-19 trunk 52672) [x86_64-linux]
[ruby-core:71682]

Description

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) objspace_expose_intern_meta.rb Eregon (Benoit Daloze), 11/25/2015 10:24 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0