[Python-checkins] python/dist/src/Objects setobject.c,1.3,1.4
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Tue Nov 18 09:15:34 EST 2003
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv13579
Modified Files:
setobject.c
Log Message:
Use PySequence_Contains() instead of direct access macro.
Index: setobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** setobject.c 17 Nov 2003 16:42:32 -0000 1.3
--- setobject.c 18 Nov 2003 14:15:31 -0000 1.4
***************
*** 10,19 ****
*/
- /* Fast access macros */
-
- #define DICT_CONTAINS(d, k) (d->ob_type->tp_as_sequence->sq_contains(d, k))
-
- /* set object **********************************************************/
-
static PyObject *
make_new_set(PyTypeObject *type, PyObject *iterable)
--- 10,13 ----
***************
*** 113,117 ****
set_contains(PySetObject *so, PyObject *key)
{
! return DICT_CONTAINS(so->data, key);
}
--- 107,111 ----
set_contains(PySetObject *so, PyObject *key)
{
! return PySequence_Contains(so->data, key);
}
***************
*** 248,252 ****
tgtdata = result->data;
while ((item = PyIter_Next(it)) != NULL) {
! if (DICT_CONTAINS(selfdata, item)) {
if (PyDict_SetItem(tgtdata, item, Py_True) == -1) {
Py_DECREF(it);
--- 242,246 ----
tgtdata = result->data;
while ((item = PyIter_Next(it)) != NULL) {
! if (PySequence_Contains(selfdata, item)) {
if (PyDict_SetItem(tgtdata, item, Py_True) == -1) {
Py_DECREF(it);
***************
*** 288,292 ****
selfdata = so->data;
while ((item = PyIter_Next(it)) != NULL) {
! if (DICT_CONTAINS(selfdata, item)) {
if (PyDict_SetItem(newdict, item, Py_True) == -1) {
Py_DECREF(newdict);
--- 282,286 ----
selfdata = so->data;
while ((item = PyIter_Next(it)) != NULL) {
! if (PySequence_Contains(selfdata, item)) {
if (PyDict_SetItem(newdict, item, Py_True) == -1) {
Py_DECREF(newdict);
***************
*** 518,522 ****
while ((item = PyIter_Next(it)) != NULL) {
! if (DICT_CONTAINS(selfdata, item)) {
if (PyDict_DelItem(selfdata, item) == -1) {
Py_XDECREF(otherset);
--- 512,516 ----
while ((item = PyIter_Next(it)) != NULL) {
! if (PySequence_Contains(selfdata, item)) {
if (PyDict_DelItem(selfdata, item) == -1) {
Py_XDECREF(otherset);
***************
*** 590,594 ****
otherdata = ((PySetObject *)other)->data;
while ((item = PyIter_Next(it)) != NULL) {
! if (!DICT_CONTAINS(otherdata, item)) {
Py_DECREF(it);
Py_DECREF(item);
--- 584,588 ----
otherdata = ((PySetObject *)other)->data;
while ((item = PyIter_Next(it)) != NULL) {
! if (!PySequence_Contains(otherdata, item)) {
Py_DECREF(it);
Py_DECREF(item);
More information about the Python-checkins
mailing list