| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,5 +7,4 @@ namespace Python.Runtime.StateSerialization; | |||
| 7 | 7 | internal class TypeManagerState | |
| 8 | 8 | { | |
| 9 | 9 | public Dictionary<MaybeType, PyType> Cache { get; set; } | |
| 10 | - public Dictionary<MaybeType, Type> SlotImplementations { get; set; } | ||
| 11 | 10 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,6 @@ internal class TypeManager | |||
| 26 | 26 | private static Dictionary<MaybeType, PyType> cache = new(); | |
| 27 | 27 | ||
| 28 | 28 | private static readonly Dictionary<PyType, SlotsHolder> _slotsHolders = new Dictionary<PyType, SlotsHolder>(PythonReferenceComparer.Instance); | |
| 29 | - private static Dictionary<MaybeType, Type> _slotsImpls = new Dictionary<MaybeType, Type>(); | ||
| 30 | 29 | ||
| 31 | 30 | // Slots which must be set | |
| 32 | 31 | private static readonly string[] _requiredSlots = new string[] | |
@@ -64,21 +63,18 @@ internal static void RemoveTypes() | |||
| 64 | 63 | type.Dispose(); | |
| 65 | 64 | } | |
| 66 | 65 | cache.Clear(); | |
| 67 | - _slotsImpls.Clear(); | ||
| 68 | 66 | _slotsHolders.Clear(); | |
| 69 | 67 | } | |
| 70 | 68 | ||
| 71 | 69 | internal static TypeManagerState SaveRuntimeData() | |
| 72 | 70 | => new() | |
| 73 | 71 | { | |
| 74 | 72 | Cache = cache, | |
| 75 | - SlotImplementations = _slotsImpls, | ||
| 76 | 73 | }; | |
| 77 | 74 | ||
| 78 | 75 | internal static void RestoreRuntimeData(TypeManagerState storage) | |
| 79 | 76 | { | |
| 80 | 77 | Debug.Assert(cache == null || cache.Count == 0); | |
| 81 | - _slotsImpls = storage.SlotImplementations; | ||
| 82 | 78 | var typeCache = storage.Cache; | |
| 83 | 79 | foreach (var entry in typeCache) | |
| 84 | 80 | { | |
@@ -90,8 +86,7 @@ internal static void RestoreRuntimeData(TypeManagerState storage) | |||
| 90 | 86 | Type type = entry.Key.Value;; | |
| 91 | 87 | cache[type] = entry.Value; | |
| 92 | 88 | SlotsHolder holder = CreateSlotsHolder(entry.Value); | |
| 93 | - Debug.Assert(type == _slotsImpls[type]); | ||
| 94 | - InitializeSlots(entry.Value, _slotsImpls[type], holder); | ||
| 89 | + InitializeSlots(entry.Value, type, holder); | ||
| 95 | 90 | Runtime.PyType_Modified(entry.Value); | |
| 96 | 91 | } | |
| 97 | 92 | } | |
@@ -104,7 +99,6 @@ internal static PyType GetType(Type type) | |||
| 104 | 99 | { | |
| 105 | 100 | pyType = CreateType(type); | |
| 106 | 101 | cache[type] = pyType; | |
| 107 | - _slotsImpls.Add(type, type); | ||
| 108 | 102 | } | |
| 109 | 103 | return pyType; | |
| 110 | 104 | } | |
@@ -308,13 +302,6 @@ internal static void InitializeClass(PyType type, ClassBase impl, Type clrType) | |||
| 308 | 302 | ||
| 309 | 303 | Runtime.PyType_Modified(type.Reference); | |
| 310 | 304 | ||
| 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(); | ||
| 318 | 305 | //DebugUtil.DumpType(type); | |
| 319 | 306 | } | |
| 320 | 307 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments