Closed
Description
This fixes it:
--- a/src/runtime/lpython/lpython.py
+++ b/src/runtime/lpython/lpython.py
@@ -729,14 +729,9 @@ def c_p_pointer(cptr, targettype, targetshape=None):
newa = ctypes.cast(cptr, targettype_ptr)
return newa
else:
- if py_is_dataclass(targettype):
- if cptr.value is None:
- return None
- return ctypes.cast(cptr, ctypes.py_object).value
-
targettype_ptr = ctypes.POINTER(targettype_ptr)
newa = ctypes.cast(cptr, targettype_ptr)
- if is_ctypes_Structure(targettype):
+ if is_dataclass(targettype):
# return after wrapping newa inside PointerToStruct
return PointerToStruct(newa)
return newa
I need to find a reproducer still. This is the bug:
(HOST) C BEFORE : { 0 , 0 , 0 , ..., 0 , 0 }
./run_full_emulation.sh: line 6: 31565 Segmentation fault: 11