summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-19 21:43:18 (GMT)
committerGuido van Rossum <guido@python.org>2002-08-19 21:43:18 (GMT)
commit45ec02aed14685c353e55841b5acbc0dadee76f8 (patch)
tree0c146fdf0d488f279f0baf64b0f1fa0484274a73 /Objects/dictobject.c
parentd8dbf847b6a819ef73d7bf0c05eafbdb9aee9956 (diff)
downloadcpython-45ec02aed14685c353e55841b5acbc0dadee76f8.zip
cpython-45ec02aed14685c353e55841b5acbc0dadee76f8.tar.gz
cpython-45ec02aed14685c353e55841b5acbc0dadee76f8.tar.bz2
SF patch 576101, by Oren Tirosh: alternative implementation of
interning. I modified Oren's patch significantly, but the basic idea and most of the implementation is unchanged. Interned strings created with PyString_InternInPlace() are now mortal, and you must keep a reference to the resulting string around; use the new function PyString_InternImmortal() to create immortal interned strings.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 86c74ba..b7b499e 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -511,15 +511,9 @@ PyDict_SetItem(register PyObject *op, PyObject *key, PyObject *value)
}
mp = (dictobject *)op;
if (PyString_CheckExact(key)) {
- if (((PyStringObject *)key)->ob_sinterned != NULL) {
- key = ((PyStringObject *)key)->ob_sinterned;
- hash = ((PyStringObject *)key)->ob_shash;
- }
- else {
- hash = ((PyStringObject *)key)->ob_shash;
- if (hash == -1)
- hash = PyObject_Hash(key);
- }
+ hash = ((PyStringObject *)key)->ob_shash;
+ if (hash == -1)
+ hash = PyObject_Hash(key);
}
else {
hash = PyObject_Hash(key);