def unpack_nullterm_array(array):
 addrs = cast(array, POINTER(ctypes.c_void_p))
 l = []
 i = 0
 value = array[i]
 while value:
  l.append(value)
  free(addrs[i])
  i += 1
  value = array[i]
 free(addrs)
 return l

def unpack_nullterm_array ( array ) : addrs = cast ( array , POINTER ( ctypes . c_void_p ) ) l = [ ] i = 0 value = array [ i ] while value : l . append ( value ) free ( addrs [ i ] ) i += 1 value = array [ i ] free ( addrs ) return l
takes a null terminated array .