[Zope-Checkins] CVS: Zope/lib/python/BTrees - Interfaces.py:1.13 SetOpTemplate.c:1.25
Tim Peters
tim.one@comcast.net
Sun, 23 Jun 2002 15:36:12 -0400
Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv17896
Modified Files:
Interfaces.py SetOpTemplate.c
Log Message:
The set operation difference(X, None) was returning None instead of
returning X, contradicting the docs and common sense.
difference(None, X) continues to return None.
=== Zope/lib/python/BTrees/Interfaces.py 1.12 => 1.13 ===
c2.
- If c1 is None, then None is returned. If c2 is none, then c1
+ If c1 is None, then None is returned. If c2 is None, then c1
is returned.
+
+ If neither c1 nor c2 is None, the output is a Set if c1 is a Set or
+ TreeSet, and is a Bucket if c1 is a Bucket or BTree.
"""
def union(c1, c2):
=== Zope/lib/python/BTrees/SetOpTemplate.c 1.24 => 1.25 ===
if (o1==Py_None || o2==Py_None)
{
- Py_INCREF(Py_None);
- return Py_None;
+ /* difference(None, X) -> None; difference(X, None) -> X */
+ Py_INCREF(o1);
+ return o1;
}
return set_operation(o1, o2, 1, -1, 1, 0, 0);