[Python-checkins] python/dist/src/Objects setobject.c, 1.31.2.2, 1.31.2.3
rhettinger@users.sourceforge.net
rhettinger at users.sourceforge.net
Sat Aug 13 04:29:03 CEST 2005
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3812/Objects
Modified Files:
Tag: release24-maint
setobject.c
Log Message:
Teach set modules to correctly compute s-=s and s^=s as the empty set.
Index: setobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v
retrieving revision 1.31.2.2
retrieving revision 1.31.2.3
diff -u -d -r1.31.2.2 -r1.31.2.3
--- setobject.c 12 Aug 2005 23:47:50 -0000 1.31.2.2
+++ setobject.c 13 Aug 2005 02:28:54 -0000 1.31.2.3
@@ -193,6 +193,16 @@
PyDoc_STRVAR(copy_doc, "Return a shallow copy of a set.");
static PyObject *
+set_clear(PySetObject *so)
+{
+ PyDict_Clear(so->data);
+ so->hash = -1;
+ Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(clear_doc, "Remove all elements from this set.");
+
+static PyObject *
set_union(PySetObject *so, PyObject *other)
{
PySetObject *result;
@@ -379,6 +389,9 @@
set_difference_update(PySetObject *so, PyObject *other)
{
PyObject *item, *tgtdata, *it;
+
+ if ((PyObject *)so == other)
+ return set_clear(so);
it = PyObject_GetIter(other);
if (it == NULL)
@@ -758,16 +771,6 @@
return 0;
}
-static PyObject *
-set_clear(PySetObject *so)
-{
- PyDict_Clear(so->data);
- so->hash = -1;
- Py_RETURN_NONE;
-}
-
-PyDoc_STRVAR(clear_doc, "Remove all elements from this set.");
-
static int
set_tp_clear(PySetObject *so)
{
More information about the Python-checkins
mailing list