| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | 1 | using System; | |
| 2 | + using System.Diagnostics; | ||
| 2 | 3 | using System.Runtime.InteropServices; | |
| 3 | 4 | ||
| 4 | 5 | namespace Python.Runtime | |
@@ -85,6 +86,7 @@ internal static CLRObject Restore(object ob, IntPtr pyHandle, InterDomainContext | |||
| 85 | 86 | pyHandle = pyHandle, | |
| 86 | 87 | tpHandle = Runtime.PyObject_TYPE(pyHandle) | |
| 87 | 88 | }; | |
| 89 | + Debug.Assert(co.tpHandle != IntPtr.Zero); | ||
| 88 | 90 | co.Load(context); | |
| 89 | 91 | return co; | |
| 90 | 92 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,9 +85,11 @@ internal static void Use(ITypeOffsets offsets) | |||
| 85 | 85 | internal static Dictionary<string, int> GetOffsets() | |
| 86 | 86 | { | |
| 87 | 87 | var properties = typeof(TypeOffset).GetProperties(FieldFlags); | |
| 88 | - return properties.ToDictionary( | ||
| 89 | - keySelector: p => p.Name, | ||
| 90 | - elementSelector: p => (int)p.GetValue(obj: null, index: null)); | ||
| 88 | + var result = properties.ToDictionary( | ||
| 89 | + keySelector: p => p.Name, | ||
| 90 | + elementSelector: p => (int)p.GetValue(obj: null, index: null)); | ||
| 91 | + Debug.Assert(result.Values.Any(v => v != 0)); | ||
| 92 | + return result; | ||
| 91 | 93 | } | |
| 92 | 94 | ||
| 93 | 95 | internal static int GetOffsetUncached(string name) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments