-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deno 2 has a broken API for node:v8 when using serialize
with Float16Array
#26580
Comments
The error is only with Float16Array import { serialize, deserialize } from "node:v8";
function testSerialization(description, value) {
console.log(`\nTesting ${description}:`);
try {
const serialized = serialize(value);
const deserialized = deserialize(serialized);
console.log("✓ Serialization successful");
console.log("Original:", value);
console.log("Deserialized:", deserialized);
} catch (error) {
console.error("✗ Serialization failed:", error.message);
}
}
const arrays = {
"Float16Array": new Float16Array([1.0, 2.5, 3.14]),
"Float32Array": new Float32Array([1.0, 2.5, 3.14]),
"Float64Array": new Float64Array([1.0, 2.5, 3.14]),
"Int32Array": new Int32Array([1, 2, 3]),
"Uint8Array": new Uint8Array([1, 2, 3])
};
console.log("Deno version:", Deno.version.deno);
console.log("V8 version:", Deno.version.v8);
for (const [type, array] of Object.entries(arrays)) {
testSerialization(type, array);
}
testSerialization("Regular Array", [1.0, 2.5, 3.14]); I get the output which indicated only Float16Array is broken Deno version: 2.0.0
V8 version: 12.9.202.13-rusty
Testing Float16Array:
✗ Serialization failed: Unserializable host object: 1,2.5,3.140625
Testing Float32Array:
✓ Serialization successful
Original: Float32Array(3) [ 1, 2.5, 3.140000104904175 ]
Deserialized: Float32Array(3) [ 1, 2.5, 3.140000104904175 ]
Testing Float64Array:
✓ Serialization successful
Original: Float64Array(3) [ 1, 2.5, 3.14 ]
Deserialized: Float64Array(3) [ 1, 2.5, 3.14 ]
Testing Int32Array:
✓ Serialization successful
Original: Int32Array(3) [ 1, 2, 3 ]
Deserialized: Int32Array(3) [ 1, 2, 3 ]
Testing Uint8Array:
✓ Serialization successful
Original: Uint8Array(3) [ 1, 2, 3 ]
Deserialized: Uint8Array(3) [ 1, 2, 3 ]
Testing Regular Array:
✓ Serialization successful
Original: [ 1, 2.5, 3.14 ]
Deserialized: [ 1, 2.5, 3.14 ] |
The error is occurring because, there is no support for Float16Array, in Lines 215 to 231 in c314b2d
Lines 239 to 261 in c314b2d
|
FYI this doesn't work in Node.js either (v23.1) because |
The support for serde of |
Version: Deno 2.0.0
Here is an example code that I run
I get the error
The text was updated successfully, but these errors were encountered: