
On Thu, Nov 30, 2000 at 04:31:07AM -0800, Moshe Zadka wrote:
... *** dictobject.c 2000/09/01 23:29:27 2.65 --- dictobject.c 2000/11/30 12:31:00 2.66 *************** *** 710,713 **** --- 710,782 ----
static PyObject * + dict_firstkey(register dictobject *mp, PyObject *args) + { + register int i; + + if (!PyArg_NoArgs(args)) + return NULL;
PyArg_NoArgs() is deprecated because you cannot specify the method name. The code should be: if (!PyArg_ParseTuple(args, ":firstkey")) return NULL; (same in the next two funcs)
... + if (mp->ma_table[i].me_value != NULL) { + PyObject *key = mp->ma_table[i].me_key; + PyObject *value = mp->ma_table[i].me_value; + PyObject *item = PyTuple_New(2); + if (item == NULL) { + return NULL; + } + Py_INCREF(key); + PyTuple_SetItem(item, 0, key); + Py_INCREF(value); + PyTuple_SetItem(item, 1, value);
These can be PyTuple_SET_ITEM() since you know you have a tuple. Cheers, -g -- Greg Stein, http://www.lyra.org/