[pypy-issue] Issue #2095: type(obj) should not call obj's metaclass's __getattribute__ (pypy/pypy)

kmod issues-reply at bitbucket.org
Wed Jul 22 23:34:52 CEST 2015


New issue 2095: type(obj) should not call obj's metaclass's __getattribute__
https://bitbucket.org/pypy/pypy/issues/2095/type-obj-should-not-call-objs-metaclasss

kmod:

Not really sure what's going on here, but this code produces different output between CPython  (2.7.6) and PyPy (2.6.0):

```
class M(type):
    def __getattribute__(self, attr):
        print "getattribute", attr
        raise Exception()

class C(object):
    __metaclass__ = M

c = C()
print type(c)
```

PyPy calls `__getattribute__("__class__")` but cpython does not.  Not sure why the exception doesn't get propagated or the return value (if one was generated) gets ignored.




More information about the pypy-issue mailing list