Author: Justin Peel <notmuchtot...@gmail.com> Branch: numpy-dtype Changeset: r46224:998dd2036252 Date: 2011-08-02 20:03 -0600 http://bitbucket.org/pypy/pypy/changeset/998dd2036252/
Log: add back in int32 and uint32 dtypes diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py --- a/pypy/module/micronumpy/interp_dtype.py +++ b/pypy/module/micronumpy/interp_dtype.py @@ -89,6 +89,12 @@ def cast_uint16(val): return rffi.cast(rffi.USHORT, val) +def cast_int32(val): + return rffi.cast(rffi.INT, val) + +def cast_uint32(val): + return rffi.cast(rffi.UINT, val) + def cast_long(val): return rffi.cast(rffi.LONG, val) @@ -109,8 +115,8 @@ UInt8_dtype = Dtype(cast_uint8, unwrap_int, UInt8_num, SIGNEDLTR) Int16_dtype = Dtype(cast_int16, unwrap_int, Int16_num, SIGNEDLTR) UInt16_dtype = Dtype(cast_uint16, unwrap_int, UInt16_num, SIGNEDLTR) -#Int32_dtype = Dtype(cast_int32, unwrap_int, Int32_num, SIGNEDLTR) -#UInt32_dtype = Dtype(cast_uint32, unwrap_int, UIn32_num, UNSIGNEDLTR) +Int32_dtype = Dtype(cast_int32, unwrap_int, Int32_num, SIGNEDLTR) +UInt32_dtype = Dtype(cast_uint32, unwrap_int, UInt32_num, UNSIGNEDLTR) Long_dtype = Dtype(cast_long, unwrap_int, Long_num, SIGNEDLTR) ULong_dtype = Dtype(cast_ulong, unwrap_int, ULong_num, UNSIGNEDLTR) Int64_dtype = Dtype(cast_int64, unwrap_int, Int64_num, SIGNEDLTR) @@ -123,8 +129,8 @@ UInt8_dtype, Int16_dtype, UInt16_dtype, - None, - None, + Int32_dtype, + UInt32_dtype, Long_dtype, ULong_dtype, Int64_dtype, diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -24,8 +24,10 @@ assert array([256], 'B')[0] == 0 assert array([32768], 'h')[0] == -32768 assert array([65536], 'H')[0] == 0 - raises(OverflowError, "array([2147483648], 'l')") + raises(OverflowError, "array([2147483648], 'i')") + raises(OverflowError, "array([4294967296], 'I')") raises(OverflowError, "array([9223372036854775808], 'q')") + raises(OverflowError, "array([18446744073709551616], 'Q')") def test_int_array(self): from numpy import array _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit