From 09cf64a0ac3f4c187ef3fadfd29d8f93e0b8a84d Mon Sep 17 00:00:00 2001 From: Ron Nuriel Date: Tue, 18 Jul 2023 20:21:37 -0600 Subject: [PATCH] Fix a bug in cptr_to_u64 in emulation --- src/runtime/lpython/lpython.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/lpython/lpython.py b/src/runtime/lpython/lpython.py index 8817b63ae3..ac1453260b 100644 --- a/src/runtime/lpython/lpython.py +++ b/src/runtime/lpython/lpython.py @@ -773,10 +773,10 @@ def __repr__(self): return ctypes_c_void_p() def cptr_to_u64(cptr): - return ctypes.addressof(cptr) + return u64(ctypes.cast(cptr, ctypes.c_void_p).value) def u64_to_cptr(ivalue): - return ctypes.c_void_p(ivalue) + return ctypes.c_void_p(i64(ivalue)) def sizeof(arg): return ctypes.sizeof(convert_type_to_ctype(arg))