summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1997-10-20 17:26:25 (GMT)
committerBarry Warsaw <barry@python.org>1997-10-20 17:26:25 (GMT)
commit320ac331d110648cfb6404582e73249089086068 (patch)
treecce91c190221f94e314c1ad73682b0d73571af6d
parent9e63faaa66acaed188b84b073d80148f5b04413c (diff)
downloadcpython-320ac331d110648cfb6404582e73249089086068.zip
cpython-320ac331d110648cfb6404582e73249089086068.tar.gz
cpython-320ac331d110648cfb6404582e73249089086068.tar.bz2
dict_get(): Fixed a couple of stupid mistakes which caused crashes.
Also got rid of some unnecessary code.
-rw-r--r--Objects/dictobject.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index e5a4610..e47e6b3 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -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);