@@ -50,6 +50,8 @@ internal static ClassBase GetClass(Type type)
50
50
}
51
51
cb = CreateClass ( type ) ;
52
52
cache . Add ( type , cb ) ;
53
+ // Initialize the object later, as this might call this GetClass method recursivly (for example when a nested class inherits its declaring class...)
54
+ InitClassBase ( type , cb ) ;
53
55
return cb ;
54
56
}
55
57
@@ -62,12 +64,6 @@ internal static ClassBase GetClass(Type type)
62
64
63
65
private static ClassBase CreateClass ( Type type )
64
66
{
65
- // First, we introspect the managed type and build some class
66
- // information, including generating the member descriptors
67
- // that we'll be putting in the Python class __dict__.
68
-
69
- ClassInfo info = GetClassInfo ( type ) ;
70
-
71
67
// Next, select the appropriate managed implementation class.
72
68
// Different kinds of types, such as array types or interface
73
69
// types, want to vary certain implementation details to make
@@ -115,6 +111,18 @@ private static ClassBase CreateClass(Type type)
115
111
impl = new ClassObject ( type ) ;
116
112
}
117
113
114
+
115
+ return impl ;
116
+ }
117
+
118
+ private static void InitClassBase ( Type type , ClassBase impl )
119
+ {
120
+ // First, we introspect the managed type and build some class
121
+ // information, including generating the member descriptors
122
+ // that we'll be putting in the Python class __dict__.
123
+
124
+ ClassInfo info = GetClassInfo ( type ) ;
125
+
118
126
impl . indexer = info . indexer ;
119
127
120
128
// Now we allocate the Python type object to reflect the given
@@ -182,10 +190,8 @@ private static ClassBase CreateClass(Type type)
182
190
}
183
191
}
184
192
185
- return impl ;
186
193
}
187
194
188
-
189
195
private static ClassInfo GetClassInfo ( Type type )
190
196
{
191
197
ClassInfo ci = new ClassInfo ( type ) ;
@@ -353,6 +359,7 @@ private static ClassInfo GetClassInfo(Type type)
353
359
if ( ! ( tp . IsNestedPublic || tp . IsNestedFamily ||
354
360
tp . IsNestedFamORAssem ) )
355
361
continue ;
362
+ // Note the given instance might be uninitialized
356
363
ob = ClassManager . GetClass ( tp ) ;
357
364
ci . members [ mi . Name ] = ob ;
358
365
continue ;
0 commit comments