File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -220,8 +220,11 @@ JS::Scalar::Type BufferType::_getPyBufferType(Py_buffer *bufView) {
220220 return JS::Scalar::Float32;
221221 } else if (typeCode == ' d' ) {
222222 return JS::Scalar::Float64;
223+ } else if (typeCode == ' e' ) {
224+ return JS::Scalar::Float16;
223225 }
224226
227+
225228 // integer types
226229 // We can't rely on the type codes alone since the typecodes are mapped to C types and would have different sizes on different architectures
227230 // see https://docs.python.org/3.9/library/array.html#module-array
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ def assert_js_to_py_memoryview(buf: memoryview):
5050 assert pm .eval ("(arr)=>arr instanceof Int16Array" )(numpy .array ([1 ], dtype = numpy .int16 ))
5151 assert pm .eval ("(arr)=>arr instanceof Int32Array" )(numpy .array ([1 ], dtype = numpy .int32 ))
5252 assert pm .eval ("(arr)=>arr instanceof BigInt64Array" )(numpy .array ([1 ], dtype = numpy .int64 ))
53+ assert pm .eval ("(arr)=>arr instanceof Float16Array" )(numpy .array ([1 ], dtype = numpy .float16 ))
5354 assert pm .eval ("(arr)=>arr instanceof Float32Array" )(numpy .array ([1 ], dtype = numpy .float32 ))
5455 assert pm .eval ("(arr)=>arr instanceof Float64Array" )(numpy .array ([1 ], dtype = numpy .float64 ))
5556 assert pm .eval ("new Uint8Array([1])" ).format == "B"
@@ -60,6 +61,7 @@ def assert_js_to_py_memoryview(buf: memoryview):
6061 assert pm .eval ("new Int16Array([1])" ).format == "h"
6162 assert pm .eval ("new Int32Array([1])" ).format == "i"
6263 assert pm .eval ("new BigInt64Array([1n])" ).format == "q"
64+ assert pm .eval ("new Float16Array([1])" ).format == "e"
6365 assert pm .eval ("new Float32Array([1])" ).format == "f"
6466 assert pm .eval ("new Float64Array([1])" ).format == "d"
6567
You can’t perform that action at this time.
0 commit comments