[pypy-commit] pypy default: fix dtype.subdtype for simple types

bdkearns noreply at buildbot.pypy.org
Fri Dec 20 19:22:07 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r68509:0146c76b3d20
Date: 2013-12-20 13:04 -0500
http://bitbucket.org/pypy/pypy/changeset/0146c76b3d20/

Log:	fix dtype.subdtype for simple types

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
@@ -136,6 +136,8 @@
         return space.wrap(self.itemtype.alignment)
 
     def descr_get_subdtype(self, space):
+        if self.subdtype is None:
+            return space.w_None
         return space.newtuple([space.wrap(self.subdtype), self.descr_get_shape(space)])
 
     def descr_get_str(self, space):
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
@@ -54,6 +54,7 @@
         assert dtype(int).fields is None
         assert dtype(int).names is None
         assert dtype(int).hasobject is False
+        assert dtype(int).subdtype is None
 
         assert dtype(None) is dtype(float)
 


More information about the pypy-commit mailing list