Got AST translation working for numba.tests.test_cstring.
Modified AST type inference to use Python API for string to number conversion (was using atol/atof, which suppress Python errors). Tweaked numba.functions.CStringSlice2, and added numba.functions.CStringSlice2Len (currently unused). Added support for PyInt_FromString and PyFloat_FromString in numba.functions. Modified llnumba slicing code to type properly on 64-bit systems. Changed string slice support in numba.transforms to use Python slicing by default.
This commit is contained in:
parent
2b2407b82f
commit
c8e44702cb
1 changed files with 5 additions and 5 deletions
|
|
@ -3,14 +3,14 @@
|
||||||
|
|
||||||
def doslice (in_string, lower, upper):
|
def doslice (in_string, lower, upper):
|
||||||
l = strlen(in_string)
|
l = strlen(in_string)
|
||||||
if lower < 0:
|
if lower < lc_size_t(0):
|
||||||
lower += l
|
lower += l
|
||||||
if upper < 0:
|
if upper < lc_size_t(0):
|
||||||
upper += l
|
upper += l
|
||||||
temp_len = upper - lower
|
temp_len = upper - lower
|
||||||
if temp_len < 0:
|
if temp_len < lc_size_t(0):
|
||||||
temp_len = 0
|
temp_len = lc_size_t(0)
|
||||||
ret_val = alloca_array(li8, temp_len + 1)
|
ret_val = alloca_array(li8, temp_len + lc_size_t(1))
|
||||||
strncpy(ret_val, in_string + lower, temp_len)
|
strncpy(ret_val, in_string + lower, temp_len)
|
||||||
ret_val[temp_len] = li8(0)
|
ret_val[temp_len] = li8(0)
|
||||||
return ret_val
|
return ret_val
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue