test(python): share signed 64-bit marshal constants (#16945)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-05 12:58:47 +08:00
1 parent 6815eb481f
commit a0c836d619
3 files changed
+11 -17

No files matched your search

+7
View File
@@ -37,6 +37,13 @@ export const pythonPycHeader = (
return header;
};
export const signedInt64Constants = (): Buffer[] =>
[42n, -1n, -(1n << 63n), (1n << 63n) - 1n].map((value) => {
const payload = Buffer.alloc(8);
payload.writeBigInt64LE(value);
return Buffer.concat([Buffer.from([0x49]), payload]);
});
const marshalNone = (): Buffer => u8(0x4e);
const marshalBytes = (value: Buffer, flagged = false): Buffer =>
concat(u8(0x73 | (flagged ? FLAG_REF : 0)), u32(value.length), value);