Author: Ronan Lamy <[email protected]>
Branch: longdouble2
Changeset: r62878:b2f10642914a
Date: 2013-03-29 14:59 +0000
http://bitbucket.org/pypy/pypy/changeset/b2f10642914a/
Log: Give ComplexFloating item types a reference to their component type,
instead of their component's box type.
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
@@ -453,7 +453,7 @@
w_box_type=space.gettypefor(interp_boxes.W_UInt64Box),
)
self.w_float32dtype = W_Dtype(
- types.Float32(),
+ types.Float32_instance,
num=11,
kind=FLOATINGLTR,
name="float32",
@@ -461,7 +461,7 @@
w_box_type=space.gettypefor(interp_boxes.W_Float32Box),
)
self.w_float64dtype = W_Dtype(
- types.Float64(),
+ types.Float64_instance,
num=12,
kind=FLOATINGLTR,
name="float64",
@@ -494,7 +494,7 @@
)
if interp_boxes.ENABLED_LONG_DOUBLE and interp_boxes.long_double_size
> 8:
self.w_longdouble = W_Dtype(
- types.Float80(),
+ types.Float80_instance,
num=13,
kind=FLOATINGLTR,
name="",
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
@@ -1003,6 +1003,7 @@
T = rffi.FLOAT
BoxType = interp_boxes.W_Float32Box
format_code = "f"
+Float32_instance = Float32()
class NonNativeFloat32(BaseType, NonNativeFloat):
_attrs_ = ()
@@ -1025,6 +1026,7 @@
T = rffi.DOUBLE
BoxType = interp_boxes.W_Float64Box
format_code = "d"
+Float64_instance = Float64()
class NonNativeFloat64(BaseType, NonNativeFloat):
_attrs_ = ()
@@ -1097,8 +1099,7 @@
@specialize.argtype(1)
def box_component(self, value):
- return self.ComponentBoxType(
- rffi.cast(self.T, value))
+ return self.FloatType.box(value)
@specialize.argtype(1, 2)
def box_complex(self, real, imag):
@@ -1541,7 +1542,7 @@
T = rffi.FLOAT
BoxType = interp_boxes.W_Complex64Box
- ComponentBoxType = interp_boxes.W_Float32Box
+ FloatType = Float32_instance
NonNativeComplex64 = Complex64
@@ -1550,7 +1551,7 @@
T = rffi.DOUBLE
BoxType = interp_boxes.W_Complex128Box
- ComponentBoxType = interp_boxes.W_Float64Box
+ FloatType = Float64_instance
NonNativeComplex128 = Complex128
@@ -1572,6 +1573,7 @@
result = StringBuilder(10)
pack_float80(result, value, 10, not native_is_bigendian)
return self.box(unpack_float80(result.build(),
native_is_bigendian))
+ Float80_instance = Float80()
NonNativeFloat80 = Float80
@@ -1580,7 +1582,7 @@
T = rffi.LONGDOUBLE
BoxType = interp_boxes.W_CLongDoubleBox
- ComponentBoxType = interp_boxes.W_LongDoubleBox
+ FloatType = Float80_instance
NonNativeComplex160 = Complex160
if interp_boxes.long_double_size in (12, 16):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit