summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-10-20 20:10:00 (GMT)
committerGuido van Rossum <guido@python.org>1997-10-20 20:10:00 (GMT)
commit6fcfa72c633269c1cf265e801ed5af30aff1a730 (patch)
tree1b6f6f2354470204409baa390dbeaf3539706474 /Objects
parent9b887c791154a653dadbfabff4978179698c23eb (diff)
downloadcpython-6fcfa72c633269c1cf265e801ed5af30aff1a730.zip
cpython-6fcfa72c633269c1cf265e801ed5af30aff1a730.tar.gz
cpython-6fcfa72c633269c1cf265e801ed5af30aff1a730.tar.bz2
Correct Barry's fix -- take care of {}.get(0).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index e47e6b3..3e1e8e2 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -964,6 +964,8 @@ dict_get(mp, args)
if (!PyArg_ParseTuple(args, "O|O", &key, &failobj))
return NULL;
+ if (mp->ma_table == NULL)
+ goto finally;
#ifdef CACHE_HASH
if (!PyString_Check(key) ||
@@ -976,6 +978,7 @@ dict_get(mp, args)
}
val = lookdict(mp, key, hash)->me_value;
+ finally:
if (val == NULL)
val = failobj;
Py_INCREF(val);