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:
Jon Riehl 2012-10-23 14:35:07 -05:00
commit c8e44702cb

View file

@ -3,14 +3,14 @@
def doslice (in_string, lower, upper):
l = strlen(in_string)
if lower < 0:
if lower < lc_size_t(0):
lower += l
if upper < 0:
if upper < lc_size_t(0):
upper += l
temp_len = upper - lower
if temp_len < 0:
temp_len = 0
ret_val = alloca_array(li8, temp_len + 1)
if temp_len < lc_size_t(0):
temp_len = lc_size_t(0)
ret_val = alloca_array(li8, temp_len + lc_size_t(1))
strncpy(ret_val, in_string + lower, temp_len)
ret_val[temp_len] = li8(0)
return ret_val