Visitar URL original
Fix layout of `NativeTypeSpec` on 32 bit platforms by lostmsu · Pull Request #1765 · pythonnet/pythonnet · GitHub
Skip to content
Merged
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
Next Next commit
fixed NativeTypeSpec on 32 bit platforms
  • Loading branch information
lostmsu committed Apr 10, 2022
commit 5af19614d836fda853be922bde3d928d2a86eefc
4 changes: 2 additions & 2 deletions src/runtime/Native/NativeTypeSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct NativeTypeSpec : IDisposable
public readonly StrPtr Name;
public readonly int BasicSize;
public readonly int ItemSize;
public readonly TypeFlags Flags;
public readonly IntPtr Flags;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, Flags is clearly defined as a C int, which should "always" be 32bit, right? (https://docs.python.org/3/c-api/type.html#c.PyType_Spec)

public IntPtr Slots;

public NativeTypeSpec(TypeSpec spec)
Expand All @@ -20,7 +20,7 @@ public NativeTypeSpec(TypeSpec spec)
this.Name = new StrPtr(spec.Name, Encoding.UTF8);
this.BasicSize = spec.BasicSize;
this.ItemSize = spec.ItemSize;
this.Flags = spec.Flags;
this.Flags = new IntPtr((long)spec.Flags);

unsafe
{
Expand Down