[pypy-commit] pypy numpy-record-dtypes: intp

fijal noreply at buildbot.pypy.org
Mon Feb 6 18:33:07 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-record-dtypes
Changeset: r52141:6f8ec889129b
Date: 2012-02-06 19:32 +0200
http://bitbucket.org/pypy/pypy/changeset/6f8ec889129b/

Log:	intp

diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
--- a/pypy/module/micronumpy/__init__.py
+++ b/pypy/module/micronumpy/__init__.py
@@ -60,6 +60,7 @@
         'float_': 'interp_boxes.W_Float64Box',
         'float32': 'interp_boxes.W_Float32Box',
         'float64': 'interp_boxes.W_Float64Box',
+        'intp': 'types.IntP.BoxType',
         #'str_': 'interp_boxes.W_StringBox',
         #'unicode_': 'interp_boxes.W_UnicodeBox',
         #'void': 'interp_boxes.W_VoidBox',
diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -7,7 +7,6 @@
 from pypy.rlib.rarithmetic import LONG_BIT
 from pypy.tool.sourcetools import func_with_new_name
 
-
 MIXIN_32 = (int_typedef,) if LONG_BIT == 32 else ()
 MIXIN_64 = (int_typedef,) if LONG_BIT == 64 else ()
 
@@ -280,4 +279,3 @@
 
     __new__ = interp2app(W_Float64Box.descr__new__.im_func),
 )
-
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
@@ -405,10 +405,15 @@
 
     def test_various_types(self):
         import _numpypy as numpy
+        import sys
         
         assert numpy.int16 is numpy.short
         assert numpy.int8 is numpy.byte
         assert numpy.bool_ is numpy.bool8
+        if sys.maxint == (1 << 63) - 1:
+            assert numpy.intp is numpy.int64
+        else:
+            assert numpy.intp is numpy.int32
 
     def test_mro(self):
         import _numpypy as numpy
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -513,3 +513,9 @@
     T = rffi.DOUBLE
     BoxType = interp_boxes.W_Float64Box
     format_code = "d"
+
+for tp in [Int32, Int64]:
+    if tp.T == lltype.Signed:
+        IntP = tp
+        break
+del tp


More information about the pypy-commit mailing list