diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2005-06-06 17:31:32 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2005-06-06 17:31:32 (GMT) |
commit | ac741c57d4ec9542622e620298260036760b2575 (patch) | |
tree | 8599017bcf788fa8d2d2db5ebe63219b027b3170 /Modules/_bsddb.c | |
parent | 889bca0df11207fa94e618942bb5f1fcf32140fd (diff) | |
download | cpython-ac741c57d4ec9542622e620298260036760b2575.zip cpython-ac741c57d4ec9542622e620298260036760b2575.tar.gz cpython-ac741c57d4ec9542622e620298260036760b2575.tar.bz2 |
change set_bt_compare() callback comparison function to only take two
arguments (left, right) like any sane comparison function. no need to
pass in the db object as an argument.
Diffstat (limited to 'Modules/_bsddb.c')
-rw-r--r-- | Modules/_bsddb.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 9d1222b..775457b 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -97,7 +97,7 @@ #error "eek! DBVER can't handle minor versions > 9" #endif -#define PY_BSDDB_VERSION "4.3.2" +#define PY_BSDDB_VERSION "4.3.3" static char *rcs_id = "$Id$"; @@ -2019,11 +2019,10 @@ _db_compareCallback (DB* db, leftObject = PyString_FromStringAndSize (leftKey->data, leftKey->size); rightObject = PyString_FromStringAndSize (rightKey->data, rightKey->size); - args = PyTuple_New (3); + args = PyTuple_New (2); Py_INCREF (self); - PyTuple_SET_ITEM (args, 0, (PyObject *) self); - PyTuple_SET_ITEM (args, 1, leftObject); /* steals reference */ - PyTuple_SET_ITEM (args, 2, rightObject); /* steals reference */ + PyTuple_SET_ITEM (args, 0, leftObject); /* steals reference */ + PyTuple_SET_ITEM (args, 1, rightObject); /* steals reference */ result = PyEval_CallObject (self->btCompareCallback, args); if (result == 0) { @@ -2072,14 +2071,12 @@ DB_set_bt_compare (DBObject* self, PyObject* args) * string objects here. verify that it returns an int (0). * err if not. */ - tuple = PyTuple_New (3); - Py_INCREF (self); - PyTuple_SET_ITEM (tuple, 0, (PyObject *) self); + tuple = PyTuple_New (2); emptyStr = PyString_FromStringAndSize (NULL, 0); Py_INCREF(emptyStr); - PyTuple_SET_ITEM (tuple, 1, emptyStr); - PyTuple_SET_ITEM (tuple, 2, emptyStr); /* steals reference */ + PyTuple_SET_ITEM (tuple, 0, emptyStr); + PyTuple_SET_ITEM (tuple, 1, emptyStr); /* steals reference */ result = PyEval_CallObject (comparator, tuple); Py_DECREF (tuple); if (result == 0 || !PyInt_Check(result)) { |