Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r69393:dd3bfb14bdc7
Date: 2014-02-24 23:15 -0500
http://bitbucket.org/pypy/pypy/changeset/dd3bfb14bdc7/

Log:    enable dtype(np.generic) creation

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
@@ -827,10 +827,8 @@
             NPY.STRING:   [space.w_str,
                            space.gettypefor(interp_boxes.W_CharacterBox)],
             NPY.UNICODE:  [space.w_unicode],
-            NPY.VOID:     [], #space.w_buffer,
-                              # XXX no buffer in space
-                              #space.gettypefor(interp_boxes.W_GenericBox),
-                              # XXX fix, leads to _coerce error
+            NPY.VOID:     [space.gettypefor(interp_boxes.W_GenericBox)],
+                           #space.w_buffer,  # XXX no buffer in space
         }
         float_dtypes = [self.w_float16dtype, self.w_float32dtype,
                         self.w_float64dtype, self.w_floatlongdtype]
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
@@ -860,6 +860,7 @@
         raises(TypeError, lambda: float64(3) & 1)
 
     def test_alternate_constructs(self):
+        import numpy as np
         from numpypy import dtype
         nnp = self.non_native_prefix
         byteorder = self.native_prefix
@@ -875,6 +876,7 @@
         assert dtype('<S5').newbyteorder('=').byteorder == '|'
         assert dtype('void').byteorder == '|'
         assert dtype((int, 2)).byteorder == '|'
+        assert dtype(np.generic).str == '|V0'
 
     def test_dtype_str(self):
         from numpypy import dtype
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to