Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r59138:428fc41aca64
Date: 2012-11-29 14:10 -0800
http://bitbucket.org/pypy/pypy/changeset/428fc41aca64/
Log: make type.__prepare__ a classmethod to match cpython (though it
doesn't seem to matter)
diff --git a/pypy/objspace/std/test/test_typeobject.py
b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -1114,12 +1114,23 @@
"""
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 M(type):
+ @classmethod
+ def __prepare__(cls, *args, **kwds):
+ d = super().__prepare__(*args, **kwds)
+ d['hello'] = 42
+ return d
+ class C(metaclass=M):
+ foo = hello
+ assert C.foo == 42
+ """
class AppTestWithMethodCacheCounter:
diff --git a/pypy/objspace/std/typetype.py b/pypy/objspace/std/typetype.py
--- a/pypy/objspace/std/typetype.py
+++ b/pypy/objspace/std/typetype.py
@@ -276,5 +276,5 @@
descr_del___abstractmethods__),
__subclasses__ = gateway.interp2app(descr___subclasses__),
__weakref__ = weakref_descr,
- __prepare__ = gateway.interp2app(descr___prepare__),
+ __prepare__ = gateway.interp2app(descr___prepare__, as_classmethod=True),
)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit