Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix stackoverflowexception
  • Loading branch information
matthid committed Aug 26, 2016
commit 502001e6db4f0d7f198d677ec4e1e165054a37fd
23 changes: 15 additions & 8 deletions src/runtime/classmanager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ internal static ClassBase GetClass(Type type)
}
cb = CreateClass(type);
cache.Add(type, cb);
// Initialize the object later, as this might call this GetClass method recursivly (for example when a nested class inherits its declaring class...)
InitClassBase(type, cb);
return cb;
}

Expand All @@ -62,12 +64,6 @@ internal static ClassBase GetClass(Type type)

private static ClassBase CreateClass(Type type)
{
// First, we introspect the managed type and build some class
// information, including generating the member descriptors
// that we'll be putting in the Python class __dict__.

ClassInfo info = GetClassInfo(type);

// Next, select the appropriate managed implementation class.
// Different kinds of types, such as array types or interface
// types, want to vary certain implementation details to make
Expand Down Expand Up @@ -115,6 +111,18 @@ private static ClassBase CreateClass(Type type)
impl = new ClassObject(type);
}


return impl;
}

private static void InitClassBase(Type type, ClassBase impl)
{
// First, we introspect the managed type and build some class
// information, including generating the member descriptors
// that we'll be putting in the Python class __dict__.

ClassInfo info = GetClassInfo(type);

impl.indexer = info.indexer;

// Now we allocate the Python type object to reflect the given
Expand Down Expand Up @@ -182,10 +190,8 @@ private static ClassBase CreateClass(Type type)
}
}

return impl;
}


private static ClassInfo GetClassInfo(Type type)
{
ClassInfo ci = new ClassInfo(type);
Expand Down Expand Up @@ -353,6 +359,7 @@ private static ClassInfo GetClassInfo(Type type)
if (!(tp.IsNestedPublic || tp.IsNestedFamily ||
tp.IsNestedFamORAssem))
continue;
// Note the given instance might be uninitialized
ob = ClassManager.GetClass(tp);
ci.members[mi.Name] = ob;
continue;
Expand Down