Skip to content

Commit

Permalink
Adding runtime typechecking to SharedMemory::_from_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
atilag committed Oct 25, 2024
1 parent 4440fe9 commit cd78fa1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wasmtime/_sharedmemory.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def __init__(self, engine: Engine, ty: MemoryType):

@classmethod
def _from_raw(cls, sharedmemory: ffi.wasmtime_sharedmemory_t) -> "SharedMemory":
if not isinstance(sharedmemory, ffi.wasmtime_sharedmemory_t):
raise TypeError("wrong shared memory pointer type provided to _from_raw")

ty: "SharedMemory" = cls.__new__(cls)
ty._set_ptr(sharedmemory)
return ty
Expand Down

0 comments on commit cd78fa1

Please sign in to comment.