[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees - Interfaces.py:1.4 SetOpTemplate.c:1.3

Tim Peters tim.one@comcast.net
Sun, 23 Jun 2002 15:38:09 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv18134

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.


=== Zope3/lib/python/Persistence/BTrees/Interfaces.py 1.3 => 1.4 ===
         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):


=== Zope3/lib/python/Persistence/BTrees/SetOpTemplate.c 1.2 => 1.3 ===
   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);