]> granicus.if.org Git - python/commitdiff
dict_get(): Fixed a couple of stupid mistakes which caused crashes.
authorBarry Warsaw <barry@python.org>
Mon, 20 Oct 1997 17:26:25 +0000 (17:26 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 20 Oct 1997 17:26:25 +0000 (17:26 +0000)
Also got rid of some unnecessary code.

Objects/dictobject.c

index e5a461031ebb53a58986d20f6fe1569dd5b7f99d..e47e6b3cba47ff2e8f50fc0d81e4851a4c50ef36 100644 (file)
@@ -958,19 +958,13 @@ dict_get(mp, args)
        PyObject *args;
 {
        PyObject *key;
-       PyObject *failobj = NULL;
+       PyObject *failobj = Py_None;
        PyObject *val = NULL;
        long hash;
 
-       if (mp->ma_table == NULL)
-               goto finally;
-
        if (!PyArg_ParseTuple(args, "O|O", &key, &failobj))
                return NULL;
 
-       if (failobj == NULL)
-               failobj = Py_None;
-
 #ifdef CACHE_HASH
        if (!PyString_Check(key) ||
            (hash = ((PyStringObject *) key)->ob_shash) == -1)
@@ -981,7 +975,7 @@ dict_get(mp, args)
                        return NULL;
        }
        val = lookdict(mp, key, hash)->me_value;
-  finally:
+
        if (val == NULL)
                val = failobj;
        Py_INCREF(val);