Message2848

Author pjenvey
Recipients
Date 2007-08-29.20:01:45
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Your patch does indeed fix the original issue, but checking for an instance of PyDictionary in PyObject isn't the right solution here. PyObject doesn't need to know anything about its PyDictionary subclass when we can utilize polymorphism to make PyDictionary do the right thing

PyObject subclasses are made to be able to override PyObject methods when they want to implement their own custom versions (such as for performance reasons, like this issue) of Python methods

So PyDictionary needs to override __contains__ to call its own dict___contains__. PyObject's in/notin can stay the same; simply call __contains__

The following patch does this instead (I can't attach it here):

http://underboss.org/~pjenvey/patches/dict_contains_r3455.diff

It also changes dict___contains__ to call has_key instead of the final dict_has_key method -- so if a subclass overrides has_key, __contains__ will utilize the overridden version 
History
Date User Action Args
2008-02-20 17:18:48adminlinkissue1783803 messages
2008-02-20 17:18:48admincreate