diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-05-24 16:56:35 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-05-24 16:56:35 (GMT) |
commit | cd35306a25ef4a7c67edc50f0cec0af5a4b7ea41 (patch) | |
tree | b1a5ec63de12626b5597d786d247b21854a32f5c /Objects/dictobject.c | |
parent | f8a548c23c13762ce739380c4d6f530b3297e16a (diff) | |
download | cpython-cd35306a25ef4a7c67edc50f0cec0af5a4b7ea41.zip cpython-cd35306a25ef4a7c67edc50f0cec0af5a4b7ea41.tar.gz cpython-cd35306a25ef4a7c67edc50f0cec0af5a4b7ea41.tar.bz2 |
Patch #424335: Implement string_richcompare, remove string_compare.
Use new _PyString_Eq in lookdict_string.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 2854efc..d5700c9 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -294,7 +294,7 @@ lookdict(dictobject *mp, PyObject *key, register long hash) * this assumption allows testing for errors during PyObject_Compare() to * be dropped; string-string comparisons never raise exceptions. This also * means we don't need to go through PyObject_Compare(); we can always use - * the tp_compare slot of the string type object directly. + * _PyString_Eq directly. * * This really only becomes meaningful if proper error handling in lookdict() * is too expensive. @@ -308,7 +308,6 @@ lookdict_string(dictobject *mp, PyObject *key, register long hash) register unsigned int mask = mp->ma_size-1; dictentry *ep0 = mp->ma_table; register dictentry *ep; - cmpfunc compare = PyString_Type.tp_compare; /* make sure this function doesn't have to handle non-string keys */ if (!PyString_Check(key)) { @@ -328,7 +327,7 @@ lookdict_string(dictobject *mp, PyObject *key, register long hash) freeslot = ep; else { if (ep->me_hash == hash - && compare(ep->me_key, key) == 0) { + && _PyString_Eq(ep->me_key, key)) { return ep; } freeslot = NULL; @@ -347,7 +346,7 @@ lookdict_string(dictobject *mp, PyObject *key, register long hash) if (ep->me_key == key || (ep->me_hash == hash && ep->me_key != dummy - && compare(ep->me_key, key) == 0)) + && _PyString_Eq(ep->me_key, key))) return ep; if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; |