[Python-checkins] python/dist/src/Objects dictobject.c,2.149,2.150

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Dec 13 08:31:57 EST 2003


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv27263

Modified Files:
	dictobject.c 
Log Message:
Simplify previous checkin -- a new function was not needed.

Index: dictobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v
retrieving revision 2.149
retrieving revision 2.150
diff -C2 -d -r2.149 -r2.150
*** dictobject.c	13 Dec 2003 11:26:11 -0000	2.149
--- dictobject.c	13 Dec 2003 13:31:55 -0000	2.150
***************
*** 499,527 ****
  }
  
- 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.
--- 499,502 ----
***************
*** 1814,1818 ****
  	{"__contains__",(PyCFunction)dict_has_key,      METH_O | METH_COEXIST,
  	 contains__doc__},
! 	{"__getitem__", (PyCFunction)dict_getitem,	METH_O | METH_COEXIST,
  	 getitem__doc__},
  	{"has_key",	(PyCFunction)dict_has_key,      METH_O,
--- 1789,1793 ----
  	{"__contains__",(PyCFunction)dict_has_key,      METH_O | METH_COEXIST,
  	 contains__doc__},
! 	{"__getitem__", (PyCFunction)dict_subscript,	METH_O | METH_COEXIST,
  	 getitem__doc__},
  	{"has_key",	(PyCFunction)dict_has_key,      METH_O,





More information about the Python-checkins mailing list