kost BebiX wrote:
Hi everyone!
I just saw a bug (?) in bson.dbref:DBRef.__getattr__

Here's they're code:
    def __getattr__(self, key):
        return self.__kwargs[key]

And when you do copy.deepcopy on that object it will raise you KeyError. So 
here's a small piece of code that reproduces the problem:

from http://docs.python.org/reference/datamodel.html

About __getattr__
"This method should return the (computed) attribute value or raise an AttributeError <http://docs.python.org/library/exceptions.html#exceptions.AttributeError> exception."

The code you provided raises a KeyError thus methods such as 'getattr' will fail as they expect an AttributeError exception.

JM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to