[issue3635] pickle.dumps cannot save instance of dict-derived class that overrides __getattribute__

Alexandre Vassalotti report at bugs.python.org
Tue Dec 6 04:35:11 CET 2011


Alexandre Vassalotti <alexandre at peadrop.com> added the comment:

I don't think it is a bug.

The posted code completely breaks the expected behavior of __getattribute__. With a such implementation, there is nothing we can do with this object as we cannot introspect it.

Use the following if you really need this kind of behaviour:

class E(dict):
    def __getattribute__(self,name):
        try:
            return self[name]
        except KeyError:
            return dict.__getattribute__(self, name)

----------
resolution:  -> works for me
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3635>
_______________________________________


More information about the Python-bugs-list mailing list