Skip to content

Commit a429650

Browse files
author
Chris Dickinson
committed
fix: emplacement bug in host function return values
1 parent 30e2829 commit a429650

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

extism/extism.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,13 @@ def _map_ret(xs) -> List[Tuple[ValType, Callable[[Any, Any, Any], Any]]]:
327327
]
328328

329329
if xs == int:
330-
return [(ValType.I64, lambda _, slot, value: slot.assign(value))]
330+
return [(ValType.I64, lambda plugin, slot, value: plugin.return_bytes(slot, value.to_bytes(length=8, byteorder='little')))]
331331

332332
if xs == float:
333-
return [(ValType.F64, lambda _, slot, value: slot.assign(value))]
333+
return [(ValType.F64, lambda plugin, slot, value: plugin.return_bytes(slot, value.to_bytes(length=8, byteorder='little')))]
334334

335335
if xs == bool:
336-
return [(ValType.I32, lambda _, slot, value: slot.assign(value))]
336+
return [(ValType.I32, lambda plugin, slot, value: plugin.return_bytes(slot, value.to_bytes(length=4, byteorder='little')))]
337337

338338
if get_origin(xs) == tuple:
339339
return functools.reduce(lambda lhs, rhs: lhs + _map_ret(rhs), get_args(xs), [])

0 commit comments

Comments
 (0)