Author: Maciej Fijalkowski <fij...@gmail.com> Branch: numpy-record-dtypes Changeset: r53134:6dcf1d779df6 Date: 2012-03-02 22:54 -0800 http://bitbucket.org/pypy/pypy/changeset/6dcf1d779df6/
Log: fix the merge diff --git a/pypy/module/micronumpy/interp_support.py b/pypy/module/micronumpy/interp_support.py --- a/pypy/module/micronumpy/interp_support.py +++ b/pypy/module/micronumpy/interp_support.py @@ -74,21 +74,24 @@ raise OperationError(space.w_ValueError, space.wrap( "string is smaller than requested size")) - a = W_NDimArray(count, [count], dtype=dtype) - fromstring_loop(a, count, dtype, itemsize, s) + a = W_NDimArray([count], dtype=dtype) + fromstring_loop(a, dtype, itemsize, s) return space.wrap(a) -fromstring_driver = jit.JitDriver(greens=[], reds=['count', 'i', 'itemsize', - 'dtype', 's', 'a']) +fromstring_driver = jit.JitDriver(greens=[], reds=['i', 'itemsize', + 'dtype', 'ai', 's', 'a']) -def fromstring_loop(a, count, dtype, itemsize, s): +def fromstring_loop(a, dtype, itemsize, s): i = 0 - while i < count: - fromstring_driver.jit_merge_point(a=a, count=count, dtype=dtype, - itemsize=itemsize, s=s, i=i) + ai = a.create_iter() + while not ai.done(): + fromstring_driver.jit_merge_point(a=a, dtype=dtype, + itemsize=itemsize, s=s, i=i, + ai=ai) val = dtype.itemtype.runpack_str(s[i*itemsize:i*itemsize + itemsize]) - a.dtype.setitem(a.storage, i, val) - i += itemsize + a.dtype.setitem(a, ai.offset, val) + ai = ai.next(1) + i += 1 @unwrap_spec(s=str, count=int, sep=str) def fromstring(space, s, w_dtype=None, count=-1, sep=''): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit