From: Guido van Rossum Date: Mon, 20 Oct 1997 20:10:00 +0000 (+0000) Subject: Correct Barry's fix -- take care of {}.get(0). X-Git-Tag: v1.5b1~191 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6fcfa72c633269c1cf265e801ed5af30aff1a730;p=python Correct Barry's fix -- take care of {}.get(0). --- diff --git a/Objects/dictobject.c b/Objects/dictobject.c index e47e6b3cba..3e1e8e2795 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);