Author: mattip <[email protected]>
Branch: numpypy-longdouble
Changeset: r59583:b53ceee87da4
Date: 2012-12-27 01:01 +0200
http://bitbucket.org/pypy/pypy/changeset/b53ceee87da4/

Log:    fix for sizeof(long double)==8, i.e. windows

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
@@ -413,6 +413,24 @@
             alternate_constructors=[space.w_float],
             aliases=["float"],
         )
+        self.w_complex64dtype = W_Dtype(
+            types.Complex64(),
+            num=14,
+            kind=COMPLEXLTR,
+            name="complex64",
+            char="F",
+            w_box_type = space.gettypefor(interp_boxes.W_Complex64Box),
+        )
+        self.w_complex128dtype = W_Dtype(
+            types.Complex128(),
+            num=15,
+            kind=COMPLEXLTR,
+            name="complex128",
+            char="D",
+            w_box_type = space.gettypefor(interp_boxes.W_Complex128Box),
+            alternate_constructors=[space.w_complex],
+            aliases=["complex"],
+        )
         if interp_boxes.long_double_size == 12:
             self.w_float96dtype = W_Dtype(
                 types.Float96(),
@@ -461,27 +479,9 @@
             )
             clongdouble = self.w_complex256dtype
         else:
-            self.w_float64type.aliases += ["longfloat", "longdouble"]
+            self.w_float64dtype.aliases += ["longfloat", "longdouble"]
             longdouble = self.w_float64dtype
-            clongdouble = self.w_complex64type
-        self.w_complex64dtype = W_Dtype(
-            types.Complex64(),
-            num=14,
-            kind=COMPLEXLTR,
-            name="complex64",
-            char="F",
-            w_box_type = space.gettypefor(interp_boxes.W_Complex64Box),
-        )
-        self.w_complex128dtype = W_Dtype(
-            types.Complex128(),
-            num=15,
-            kind=COMPLEXLTR,
-            name="complex128",
-            char="D",
-            w_box_type = space.gettypefor(interp_boxes.W_Complex128Box),
-            alternate_constructors=[space.w_complex],
-            aliases=["complex"],
-        )
+            clongdouble = self.w_complex64dtype
         self.w_stringdtype = W_Dtype(
             types.StringType(1),
             num=18,
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
@@ -117,8 +117,10 @@
         from _numpypy import array, dtype
         types = [
             '?', 'b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q', 'f', 'd', 
-            'e', 'g',
+            'e'
         ]
+        if array([0], dtype='longdouble').itemsize > 8:
+            types += ['g', 'G']
         a = array([True], '?')
         for t in types:
             assert (a + array([0], t)).dtype is dtype(t)
@@ -474,7 +476,8 @@
     def test_longfloat(self):
         import _numpypy as numpy
         # it can be float96 or float128
-        assert numpy.longfloat.mro()[1:] == [numpy.floating,
+        if numpy.longfloat != numpy.float64:
+            assert numpy.longfloat.mro()[1:] == [numpy.floating,
                                        numpy.inexact, numpy.number, 
                                        numpy.generic, object]
         a = numpy.array([1, 2, 3], numpy.longdouble)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to