Skip to content
Merged
Changes from all 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
6 changes: 4 additions & 2 deletions src/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,9 @@ export class PyObject {
}
return new PyObject(list);
} else if (v instanceof Callback) {
const pyMethodDef = new Uint8Array(8 + 8 + 4 + 8);
// https://docs.python.org/3/c-api/structures.html#c.PyMethodDef
// there are extra 4 bytes of padding after ml_flags field
const pyMethodDef = new Uint8Array(8 + 8 + 4 + 4 + 8);
const view = new DataView(pyMethodDef.buffer);
const LE =
new Uint8Array(new Uint32Array([0x12345678]).buffer)[0] !== 0x7;
Expand All @@ -471,7 +473,7 @@ export class PyObject {
);
view.setInt32(16, 0x1 | 0x2, LE);
view.setBigUint64(
20,
24,
BigInt(Deno.UnsafePointer.value(Deno.UnsafePointer.of(nameBuf)!)),
LE,
);
Expand Down