Skip to content

Fix layout of NativeTypeSpec on 32 bit platforms #1765

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2022
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
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