[pypy-commit] pypy numpy-dtype-alt: more asserts, doesn't help.

alex_gaynor noreply at buildbot.pypy.org
Tue Aug 16 21:07:58 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: numpy-dtype-alt
Changeset: r46551:edd61bcc2fde
Date: 2011-08-16 14:11 -0500
http://bitbucket.org/pypy/pypy/changeset/edd61bcc2fde/

Log:	more asserts, doesn't help.

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
@@ -45,11 +45,10 @@
 
 VOID_TP = lltype.Ptr(lltype.Array(lltype.Void, hints={'nolength': True}))
 
-def create_low_level_dtype(num, kind, name, aliases, applevel_types, T, valtype=None):
+def create_low_level_dtype(num, kind, name, aliases, applevel_types, T, valtype):
     class Box(BaseBox):
         def __init__(self, val):
-            if valtype is not None:
-                assert isinstance(val, valtype)
+            assert isinstance(val, valtype)
             self.val = val
 
         def wrap(self, space):
@@ -218,6 +217,7 @@
     aliases = ["?"],
     applevel_types = ["bool"],
     T = lltype.Bool,
+    valtype = bool,
 )
 class W_BoolDtype(W_BoolDtype):
     def unwrap(self, space, w_item):
@@ -228,18 +228,21 @@
     aliases = ["int8"],
     applevel_types = [],
     T = rffi.SIGNEDCHAR,
+    valtype = rffi.SIGNEDCHAR._type,
 )
 W_Int32Dtype = create_low_level_dtype(
     num = 5, kind = SIGNEDLTR, name = "int32",
     aliases = ["i"],
     applevel_types = [],
     T = rffi.INT,
+    valtype = rffi.INT._type,
 )
 W_LongDtype = create_low_level_dtype(
     num = 7, kind = SIGNEDLTR, name = "???",
     aliases = ["l"],
     applevel_types = ["int"],
-    T = rffi.LONG
+    T = rffi.LONG,
+    valtype = int,
 )
 class W_LongDtype(W_LongDtype):
     def unwrap(self, space, w_item):
@@ -249,13 +252,15 @@
     num = 9, kind = SIGNEDLTR, name = "int64",
     aliases = [],
     applevel_types = ["long"],
-    T = rffi.LONGLONG
+    T = rffi.LONGLONG,
+    valtype = int,
 )
 W_Float64Dtype = create_low_level_dtype(
     num = 12, kind = FLOATINGLTR, name = "float64",
     aliases = [],
     applevel_types = ["float"],
     T = lltype.Float,
+    valtype = float,
 )
 class W_Float64Dtype(W_Float64Dtype):
     def unwrap(self, space, w_item):


More information about the pypy-commit mailing list