Commit bac77762 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Minor: if a GC is triggered in this section it will crash

We could make the typeGCHandler support these half-constructed classes,
but let's just turn off the GC for this area.
parent dbac3625
......@@ -1111,6 +1111,9 @@ void setupRuntime() {
root_hcls = HiddenClass::makeRoot();
gc::registerPermanentRoot(root_hcls);
// Disable the GC while we do some manual initialization of the object hierarchy:
gc::disableGC();
// We have to do a little dance to get object_cls and type_cls set up, since the normal
// object-creation routines look at the class to see the allocation size.
void* mem = gc_alloc(sizeof(BoxedClass), gc::GCKind::PYTHON);
......@@ -1147,6 +1150,8 @@ void setupRuntime() {
str_cls->tp_name = boxed_str_name->s.c_str();
none_cls->tp_name = boxed_none_name->s.c_str();
gc::enableGC();
unicode_cls = new BoxedHeapClass(basestring_cls, NULL, 0, sizeof(BoxedUnicode), false, "unicode");
// It wasn't safe to add __base__ attributes until object+type+str are set up, so do that now:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment