diff options
author | Raymond Hettinger <python@rcn.com> | 2003-12-13 13:31:55 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-12-13 13:31:55 (GMT) |
commit | 0c66967e3d4e21f8c14501ef4d5cf53a9eaf6796 (patch) | |
tree | 40ab6451d506fddf7c2382fcbda188b0bd06188c /Objects | |
parent | d3ae6729e7e04d505c29450aed7ef64343ec9eb1 (diff) | |
download | cpython-0c66967e3d4e21f8c14501ef4d5cf53a9eaf6796.zip cpython-0c66967e3d4e21f8c14501ef4d5cf53a9eaf6796.tar.gz cpython-0c66967e3d4e21f8c14501ef4d5cf53a9eaf6796.tar.bz2 |
Simplify previous checkin -- a new function was not needed.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/dictobject.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 013f5f2..35a3e31 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -498,31 +498,6 @@ PyDict_GetItem(PyObject *op, PyObject *key) return (mp->ma_lookup)(mp, key, hash)->me_value; } -static PyObject * -dict_getitem(PyObject *op, PyObject *key) -{ - long hash; - dictobject *mp = (dictobject *)op; - PyObject *v; - - if (!PyDict_Check(op)) { - return NULL; - } - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) - { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } - v = (mp->ma_lookup)(mp, key, hash) -> me_value; - if (v == NULL) - PyErr_SetObject(PyExc_KeyError, key); - else - Py_INCREF(v); - return v; -} - /* CAUTION: PyDict_SetItem() must guarantee that it won't resize the * dictionary if it is merely replacing the value for an existing key. * This is means that it's safe to loop over a dictionary with @@ -1813,7 +1788,7 @@ PyDoc_STRVAR(iteritems__doc__, static PyMethodDef mapp_methods[] = { {"__contains__",(PyCFunction)dict_has_key, METH_O | METH_COEXIST, contains__doc__}, - {"__getitem__", (PyCFunction)dict_getitem, METH_O | METH_COEXIST, + {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, getitem__doc__}, {"has_key", (PyCFunction)dict_has_key, METH_O, has_key__doc__}, |