From c8e44702cb4f1a3ec88acf503c144630d81222e9 Mon Sep 17 00:00:00 2001 From: Jon Riehl Date: Tue, 23 Oct 2012 14:35:07 -0500 Subject: [PATCH] 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. --- tests/llfuncs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/llfuncs.py b/tests/llfuncs.py index 55e9000..2a8614f 100644 --- a/tests/llfuncs.py +++ b/tests/llfuncs.py @@ -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