Commits

Armin Rigo committed 18eccde

Test and fix.

  • Participants
  • Parent commits 228da25

Comments (0)

Files changed (2)

File pypy/module/array/interp_array.py

 
 
 def make_array(mytype):
+    W_ArrayBase = globals()['W_ArrayBase']
+
     class W_Array(W_ArrayBase):
         itemsize = mytype.bytes
         typecode = mytype.typecode
 
         @staticmethod
         def register(typeorder):
-            typeorder[W_Array] = []
+            typeorder[W_Array] = [(W_ArrayBase, None)]
 
         def __init__(self, space):
             self.space = space
     # Compare methods
     @specialize.arg(3)
     def _cmp_impl(space, self, other, space_fn):
-        if isinstance(other, W_ArrayBase):
-            w_lst1 = array_tolist__Array(space, self)
-            w_lst2 = space.call_method(other, 'tolist')
-            return space_fn(w_lst1, w_lst2)
-        else:
-            return space.w_NotImplemented
+        w_lst1 = array_tolist__Array(space, self)
+        w_lst2 = space.call_method(other, 'tolist')
+        return space_fn(w_lst1, w_lst2)
 
-    def eq__Array_ANY(space, self, other):
+    def eq__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.eq)
 
-    def ne__Array_ANY(space, self, other):
+    def ne__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.ne)
 
-    def lt__Array_ANY(space, self, other):
+    def lt__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.lt)
 
-    def le__Array_ANY(space, self, other):
+    def le__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.le)
 
-    def gt__Array_ANY(space, self, other):
+    def gt__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.gt)
 
-    def ge__Array_ANY(space, self, other):
+    def ge__Array_ArrayBase(space, self, other):
         return _cmp_impl(space, self, other, space.ge)
 
     # Misc methods

File pypy/module/array/test/test_array.py

         cls.maxint = sys.maxint
 
 class AppTestArray(BaseArrayTests):
+    OPTIONS = {}
+
     def setup_class(cls):
-        cls.space = gettestobjspace(usemodules=('array', 'struct', '_rawffi'))
+        cls.space = gettestobjspace(usemodules=('array', 'struct', '_rawffi'),
+                                    **cls.OPTIONS)
         cls.w_array = cls.space.appexec([], """():
             import array
             return array.array
         a = self.array('b', range(4))
         a[::-1] = a
         assert a == self.array('b', [3, 2, 1, 0])
+
+
+class AppTestArrayBuiltinShortcut(AppTestArray):
+    OPTIONS = {'objspace.std.builtinshortcut': True}