Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TypeOffset class no longer depends on target Python version#1292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
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
2 changes: 2 additions & 0 deletions.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
/src/runtime/interopNative.cs

# General binaries and Build results
*.dll
*.exe
Expand Down
5 changes: 5 additions & 0 deletionspythonnet.15.sln
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "conda.recipe", "conda.recip
conda.recipe\README.md = conda.recipe\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{BC426F42-8494-4AA5-82C9-5109ACD97BD1}"
ProjectSection(SolutionItems) = preProject
tools\geninterop\geninterop.py = tools\geninterop\geninterop.py
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
4 changes: 4 additions & 0 deletionssrc/runtime/Python.Runtime.csproj
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,6 +80,10 @@
<Compile Include="Codecs\DecoderGroup.cs" />
<Compile Include="Codecs\RawProxyEncoder.cs" />
<Compile Include="Codecs\TupleCodecs.cs" />
<Compile Include="native\ABI.cs" />
<Compile Include="native\GeneratedTypeOffsets.cs" />
<Compile Include="native\ITypeOffsets.cs" />
<Compile Include="native\TypeOffset.cs" />
<Compile Include="converterextensions.cs" />
<Compile Include="finalizer.cs" />
<Compile Include="intern.cs" />
Expand Down
8 changes: 4 additions & 4 deletionssrc/runtime/debughelper.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,13 @@ internal static void DumpType(IntPtr type)
//DebugUtil.Print(" mro: ", op);


FieldInfo[] slots =typeof(TypeOffset).GetFields();
var slots = TypeOffset.GetOffsets();
int size = IntPtr.Size;

for (vari = 0; i <slots.Length; i++)
foreach (varentry inslots)
{
int offset =i * size;
name =slots[i].Name;
int offset =entry.Value;
name =entry.Key;
op = Marshal.ReadIntPtr(type, offset);
Console.WriteLine(" {0}: {1}", name, op);
}
Expand Down
23 changes: 2 additions & 21 deletionssrc/runtime/interop.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,25 +70,12 @@ public ModulePropertyAttribute()

internal static partial class TypeOffset
{
static TypeOffset()
{
Type type = typeof(TypeOffset);
FieldInfo[] fields = type.GetFields();
int size = IntPtr.Size;
for (int i = 0; i < fields.Length; i++)
{
int offset = i * size;
FieldInfo fi = fields[i];
fi.SetValue(null, offset);
}
}

public static int magic() => ManagedDataOffsets.Magic;
}

internal static class ManagedDataOffsets
{
public static int Magic { get;private set; }
public static int Magic { get;internal set; }
public static readonly Dictionary<string, int> NameMapping = new Dictionary<string, int>();

static class DataOffsets
Expand All@@ -108,13 +95,7 @@ static DataOffsets()

static ManagedDataOffsets()
{
Type type = typeof(TypeOffset);
foreach (FieldInfo fi in type.GetFields())
{
NameMapping[fi.Name] = (int)fi.GetValue(null);
}
// XXX: Use the members after PyHeapTypeObject as magic slot
Magic = TypeOffset.members;
NameMapping = TypeOffset.GetOffsets();

FieldInfo[] fields = typeof(DataOffsets).GetFields(BindingFlags.Static | BindingFlags.Public);
size = fields.Length * IntPtr.Size;
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp