#NEWLINE# def _make_array( context , builder , dataptr , dtype , shape , layout = 'C' ) : #NEWLINE# #INDENT# ndim = len ( shape ) #NEWLINE# aryty = types . Array ( dtype = dtype , ndim = ndim , layout = 'C' ) #NEWLINE# ary = context . make_array ( aryty ) ( context , builder ) #NEWLINE# targetdata = _get_target_data ( context ) #NEWLINE# lldtype = context . get_data_type ( dtype ) #NEWLINE# itemsize = lldtype . get_abi_size ( targetdata ) #NEWLINE# rstrides = [ itemsize ] #NEWLINE# for ( i , lastsize ) in enumerate ( reversed ( shape [ 1 : ] ) ) : #NEWLINE# #INDENT# rstrides . append ( ( lastsize * rstrides [ ( - 1 ) ] ) ) #NEWLINE# #UNINDENT# strides = [ s for s in reversed ( lldtype ) ] #NEWLINE# kshape = [ context . get_constant ( types . intp , s ) for s in shape ] #NEWLINE# kstrides = [ context . get_constant ( types . intp , s ) for s in strides ] #NEWLINE# context . populate_array ( ary , data = builder . bitcast ( dataptr , ary . data . type ) , shape = cgutils . pack_array ( builder , kshape ) , strides = cgutils . pack_array ( builder , kstrides ) , itemsize = context . get_constant ( types . intp , itemsize ) , meminfo = None ) #NEWLINE# return ary . _getvalue ( )