@@ -26,7 +26,6 @@ internal class TypeManager
2626 private static Dictionary < MaybeType , PyType > cache = new ( ) ;
2727
2828 private static readonly Dictionary < PyType , SlotsHolder > _slotsHolders = new Dictionary < PyType , SlotsHolder > ( PythonReferenceComparer . Instance ) ;
29- private static Dictionary < MaybeType , Type > _slotsImpls = new Dictionary < MaybeType , Type > ( ) ;
3029
3130 // Slots which must be set
3231 private static readonly string [ ] _requiredSlots = new string [ ]
@@ -64,21 +63,18 @@ internal static void RemoveTypes()
6463 type . Dispose ( ) ;
6564 }
6665 cache . Clear ( ) ;
67- _slotsImpls . Clear ( ) ;
6866 _slotsHolders . Clear ( ) ;
6967 }
7068
7169 internal static TypeManagerState SaveRuntimeData ( )
7270 => new ( )
7371 {
7472 Cache = cache ,
75- SlotImplementations = _slotsImpls ,
7673 } ;
7774
7875 internal static void RestoreRuntimeData ( TypeManagerState storage )
7976 {
8077 Debug . Assert ( cache == null || cache . Count == 0 ) ;
81- _slotsImpls = storage . SlotImplementations ;
8278 var typeCache = storage . Cache ;
8379 foreach ( var entry in typeCache )
8480 {
@@ -90,8 +86,7 @@ internal static void RestoreRuntimeData(TypeManagerState storage)
9086 Type type = entry . Key . Value ; ;
9187 cache [ type ] = entry . Value ;
9288 SlotsHolder holder = CreateSlotsHolder ( entry . Value ) ;
93- Debug . Assert ( type == _slotsImpls [ type ] ) ;
94- InitializeSlots ( entry . Value , _slotsImpls [ type ] , holder ) ;
89+ InitializeSlots ( entry . Value , type , holder ) ;
9590 Runtime . PyType_Modified ( entry . Value ) ;
9691 }
9792 }
@@ -104,7 +99,6 @@ internal static PyType GetType(Type type)
10499 {
105100 pyType = CreateType ( type ) ;
106101 cache [ type ] = pyType ;
107- _slotsImpls . Add ( type , type ) ;
108102 }
109103 return pyType ;
110104 }
@@ -308,13 +302,6 @@ internal static void InitializeClass(PyType type, ClassBase impl, Type clrType)
308302
309303 Runtime . PyType_Modified ( type . Reference ) ;
310304
311- #if DEBUG
312- if ( _slotsImpls . TryGetValue ( clrType , out var implType ) )
313- {
314- Debug . Assert ( implType == impl . GetType ( ) ) ;
315- }
316- #endif
317- _slotsImpls [ clrType ] = impl . GetType ( ) ;
318305 //DebugUtil.DumpType(type);
319306 }
320307
0 commit comments