mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
class.c: do not freeze meta-meta-class
* class.c (rb_freeze_singleton_class): should not propagate to meta-meta-class, and so on, which is shared with the original class. fix occational exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c7d0edb5b6
commit
d9a597408f
3 changed files with 29 additions and 6 deletions
13
class.c
13
class.c
|
@ -1578,6 +1578,19 @@ singleton_class_of(VALUE obj)
|
|||
return klass;
|
||||
}
|
||||
|
||||
void
|
||||
rb_freeze_singleton_class(VALUE x)
|
||||
{
|
||||
/* should not propagate to meta-meta-class, and so on */
|
||||
if (!(RBASIC(x)->flags & FL_SINGLETON)) {
|
||||
VALUE klass = RBASIC_CLASS(x);
|
||||
klass = RCLASS_ORIGIN(klass);
|
||||
if (FL_TEST(klass, (FL_SINGLETON|FL_FREEZE)) == FL_SINGLETON) {
|
||||
OBJ_FREEZE_RAW(klass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the singleton class of \a obj, or nil if obj is not a
|
||||
* singleton object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue