Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r67655:4e9e6df093b5
Date: 2013-10-28 13:38 -0400
http://bitbucket.org/pypy/pypy/changeset/4e9e6df093b5/

Log:    provide dtype attribute for numpy scalars

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
@@ -260,6 +260,9 @@
         raise OperationError(space.w_NotImplementedError, space.wrap(
             "view not implelemnted yet"))
 
+    def descr_get_dtype(self, space):
+        return self.get_dtype(space)
+
     def descr_get_itemsize(self, space):
         return self.get_dtype(space).descr_get_itemsize(space)
 
@@ -511,6 +514,8 @@
     round = interp2app(W_GenericBox.descr_round),
     conjugate = interp2app(W_GenericBox.descr_conjugate),
     view = interp2app(W_GenericBox.descr_view),
+
+    dtype = GetSetProperty(W_GenericBox.descr_get_dtype),
     itemsize = GetSetProperty(W_GenericBox.descr_get_itemsize),
 )
 
diff --git a/pypy/module/micronumpy/test/test_scalar.py 
b/pypy/module/micronumpy/test/test_scalar.py
--- a/pypy/module/micronumpy/test/test_scalar.py
+++ b/pypy/module/micronumpy/test/test_scalar.py
@@ -37,6 +37,7 @@
         exc = raises(AttributeError, 'b.round()')
         assert exc.value[0] == "'bool' object has no attribute 'round'"
 
-    def test_itemsize(self):
+    def test_attributes(self):
         import numpypy as np
+        assert np.int64(0).dtype == np.dtype('int64')
         assert np.int64(0).itemsize == 8
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to