[pypy-commit] pypy numpy-dtype: make get_dtype play nicely with the annotator

justinpeel noreply at buildbot.pypy.org
Wed Aug 3 22:56:10 CEST 2011


Author: Justin Peel <notmuchtotell at gmail.com>
Branch: numpy-dtype
Changeset: r46258:298694cf047a
Date: 2011-08-03 14:56 -0600
http://bitbucket.org/pypy/pypy/changeset/298694cf047a/

Log:	make get_dtype play nicely with the annotator

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
@@ -217,8 +217,9 @@
     return dtype2
 
 def get_dtype(space, str_or_type):
-    if space.is_true(space.isinstance(str_or_type, space.gettypeobject(Dtype.typedef))):
-        return str_or_type
+    as_dtype = space.interpclass_w(str_or_type)
+    if as_dtype is not None and isinstance(as_dtype, Dtype):
+        return as_dtype
     if space.is_true(space.isinstance(str_or_type, space.w_str)):
         s = space.str_w(str_or_type)
         if len(s) == 1:


More information about the pypy-commit mailing list