[Checkins] SVN: BTrees/branches/pure_python/ Stab at preventing non-orderable object keys.
Tres Seaver
cvs-admin at zope.org
Thu Nov 8 17:26:08 UTC 2012
Log message for revision 128198:
Stab at preventing non-orderable object keys.
Changed:
_U BTrees/branches/pure_python/
U BTrees/branches/pure_python/BTrees/___BTree.py
-=-
Modified: BTrees/branches/pure_python/BTrees/___BTree.py
===================================================================
--- BTrees/branches/pure_python/BTrees/___BTree.py 2012-11-08 17:26:06 UTC (rev 128197)
+++ BTrees/branches/pure_python/BTrees/___BTree.py 2012-11-08 17:26:07 UTC (rev 128198)
@@ -341,9 +341,10 @@
set(*i)
def __setitem__(self, key, value):
- # TODO: enforce test that key has non-default comparison?
- #if getattr(key, '__cmp__', None) is object.__cmp__:
- # raise TypeError("Can't use default __cmp__")
+ # Enforce test that key has non-default comparison.
+ if ( getattr(key, '__lt__', None) is None and
+ getattr(key, '__cmp__', None) is None):
+ raise TypeError("Can't use default __cmp__")
self._set(self._to_key(key), self._to_value(value))
def __delitem__(self, key):
More information about the checkins
mailing list