]> granicus.if.org Git - python/commitdiff
Correct Barry's fix -- take care of {}.get(0).
authorGuido van Rossum <guido@python.org>
Mon, 20 Oct 1997 20:10:00 +0000 (20:10 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 20 Oct 1997 20:10:00 +0000 (20:10 +0000)
Objects/dictobject.c

index e47e6b3cba47ff2e8f50fc0d81e4851a4c50ef36..3e1e8e279506c21f5f619b57dc968a84276fc141 100644 (file)
@@ -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);