Commits

Philip Jenvey committed 1fbbf6a

add type.__prepare__

Comments (0)

Files changed (2)

pypy/objspace/std/test/test_typeobject.py

         assert marker is Z
         """
 
+    def test_prepare(self):
+        classdict = type.__prepare__()
+        assert type(classdict) is dict
+        assert classdict == {}
+        assert type.__prepare__(3) == {}
+        assert type.__prepare__(3, 4) == {}
+        assert type.__prepare__(3, package='sqlalchemy') == {}
+
 
 class AppTestWithMethodCacheCounter:
     spaceconfig = {"objspace.std.withmethodcachecounter": True}

pypy/objspace/std/typetype.py

     w_type = _check(space, w_type)
     return space.newlist(w_type.get_subclasses())
 
+def descr___prepare__(space, __args__):
+    return space.newdict()
+
 # ____________________________________________________________
 
 type_typedef = StdTypeDef("type",
                                          descr_del___abstractmethods__),
     __subclasses__ = gateway.interp2app(descr___subclasses__),
     __weakref__ = weakref_descr,
+    __prepare__ = gateway.interp2app(descr___prepare__),
     )