diff options
author | Moshe Zadka <moshez@math.huji.ac.il> | 2000-11-30 19:30:21 (GMT) |
---|---|---|
committer | Moshe Zadka <moshez@math.huji.ac.il> | 2000-11-30 19:30:21 (GMT) |
commit | 5725d1eb034193e521dfe5febd675fb84e6acf5d (patch) | |
tree | 8231328e90b062702f266deae2753925402d1b77 /Objects/dictobject.c | |
parent | 1221e6df3d02c3a2eea3907cdee1f23f757956ba (diff) | |
download | cpython-5725d1eb034193e521dfe5febd675fb84e6acf5d.zip cpython-5725d1eb034193e521dfe5febd675fb84e6acf5d.tar.gz cpython-5725d1eb034193e521dfe5febd675fb84e6acf5d.tar.bz2 |
Backing out my changes.
Improved version coming soon to a Source Forge near you!
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index ecc94cd..7be1c67 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -709,75 +709,6 @@ static PyMappingMethods dict_as_mapping = { }; static PyObject * -dict_firstkey(register dictobject *mp, PyObject *args) -{ - register int i; - - if (!PyArg_NoArgs(args)) - return NULL; - if (mp->ma_used == 0) { - PyErr_SetString(PyExc_ValueError, "empty dictionary"); - return NULL; - } - for (i = 0; i < mp->ma_size; i++) { - if (mp->ma_table[i].me_value != NULL) { - PyObject *key = mp->ma_table[i].me_key; - Py_INCREF(key); - return key; - } - } -} - -static PyObject * -dict_firstvalue(register dictobject *mp, PyObject *args) -{ - register int i; - - if (!PyArg_NoArgs(args)) - return NULL; - if (mp->ma_used == 0) { - PyErr_SetString(PyExc_ValueError, "empty dictionary"); - return NULL; - } - for (i = 0; i < mp->ma_size; i++) { - if (mp->ma_table[i].me_value != NULL) { - PyObject *value = mp->ma_table[i].me_value; - Py_INCREF(value); - return value; - } - } -} - -static PyObject * -dict_firstitem(register dictobject *mp, PyObject *args) -{ - register int i; - - if (!PyArg_NoArgs(args)) - return NULL; - if (mp->ma_used == 0) { - PyErr_SetString(PyExc_ValueError, "empty dictionary"); - return NULL; - } - for (i = 0; i < mp->ma_size; i++) { - 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); - return item; - } - } -} - - -static PyObject * dict_keys(register dictobject *mp, PyObject *args) { register PyObject *v; @@ -1231,9 +1162,6 @@ static PyMethodDef mapp_methods[] = { {"keys", (PyCFunction)dict_keys}, {"items", (PyCFunction)dict_items}, {"values", (PyCFunction)dict_values}, - {"firstkey", (PyCFunction)dict_firstkey}, - {"firstitem", (PyCFunction)dict_firstitem}, - {"firstvalue", (PyCFunction)dict_firstvalue}, {"update", (PyCFunction)dict_update}, {"clear", (PyCFunction)dict_clear}, {"copy", (PyCFunction)dict_copy}, |