summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 80adc30..e356800 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1829,15 +1829,26 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
long hash = ((PyStringObject *)w)->ob_shash;
if (hash != -1) {
PyDictObject *d;
+ PyDictEntry *e;
d = (PyDictObject *)(f->f_globals);
- x = d->ma_lookup(d, w, hash)->me_value;
+ e = d->ma_lookup(d, w, hash);
+ if (e == NULL) {
+ x = NULL;
+ break;
+ }
+ x = e->me_value;
if (x != NULL) {
Py_INCREF(x);
PUSH(x);
continue;
}
d = (PyDictObject *)(f->f_builtins);
- x = d->ma_lookup(d, w, hash)->me_value;
+ e = d->ma_lookup(d, w, hash);
+ if (e == NULL) {
+ x = NULL;
+ break;
+ }
+ x = e->me_value;
if (x != NULL) {
Py_INCREF(x);
PUSH(x);