[pypy-svn] r78941 - in pypy/branch/fast-forward/pypy/objspace/std: . test
afa at codespeak.net
afa at codespeak.net
Tue Nov 9 22:10:07 CET 2010
Author: afa
Date: Tue Nov 9 22:10:05 2010
New Revision: 78941
Modified:
pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py
pypy/branch/fast-forward/pypy/objspace/std/typetype.py
Log:
Hide the type.__abstractmethods__ descriptor.
Modified: pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py Tue Nov 9 22:10:05 2010
@@ -110,6 +110,7 @@
raises(TypeError, X)
del X.__abstractmethods__
X()
+ raises(AttributeError, getattr, type, "__abstractmethods__")
def test_call_type(self):
assert type(42) is int
Modified: pypy/branch/fast-forward/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/typetype.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/typetype.py Tue Nov 9 22:10:05 2010
@@ -208,11 +208,14 @@
def descr_get___abstractmethods__(space, w_type):
w_type = _check(space, w_type)
- try:
- return w_type.dict_w["__abstractmethods__"]
- except KeyError:
- raise OperationError(space.w_AttributeError,
- space.wrap("__abstractmethods__"))
+ # type itself has an __abstractmethods__ descriptor (this). Don't return it
+ if not space.is_w(w_type, space.w_type):
+ try:
+ return w_type.dict_w["__abstractmethods__"]
+ except KeyError:
+ pass
+ raise OperationError(space.w_AttributeError,
+ space.wrap("__abstractmethods__"))
def descr_set___abstractmethods__(space, w_type, w_new):
w_type = _check(space, w_type)
More information about the Pypy-commit
mailing list