Skip to content
Merged
Show file tree
Hide file tree
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
a few extra assertions
  • Loading branch information
lostmsu committed Dec 18, 2020
commit 039b3ca24ad01931088dfddbf7dbf5840192b77e
2 changes: 2 additions & 0 deletions src/runtime/clrobject.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace Python.Runtime
Expand Down Expand Up @@ -85,6 +86,7 @@ internal static CLRObject Restore(object ob, IntPtr pyHandle, InterDomainContext
pyHandle = pyHandle,
tpHandle = Runtime.PyObject_TYPE(pyHandle)
};
Debug.Assert(co.tpHandle != IntPtr.Zero);
co.Load(context);
return co;
}
Expand Down
8 changes: 5 additions & 3 deletions src/runtime/native/TypeOffset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ internal static void Use(ITypeOffsets offsets)
internal static Dictionary<string, int> GetOffsets()
{
var properties = typeof(TypeOffset).GetProperties(FieldFlags);
return properties.ToDictionary(
keySelector: p => p.Name,
elementSelector: p => (int)p.GetValue(obj: null, index: null));
var result = properties.ToDictionary(
keySelector: p => p.Name,
elementSelector: p => (int)p.GetValue(obj: null, index: null));
Debug.Assert(result.Values.Any(v => v != 0));
return result;
}

internal static int GetOffsetUncached(string name)
Expand Down