diff options
Diffstat (limited to 'cheetah/c/_namemapper.c')
-rw-r--r-- | cheetah/c/_namemapper.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cheetah/c/_namemapper.c b/cheetah/c/_namemapper.c index a41571b..a114658 100644 --- a/cheetah/c/_namemapper.c +++ b/cheetah/c/_namemapper.c @@ -188,14 +188,15 @@ static PyObject *PyNamemapper_valueForName(PyObject *obj, char *nameChunks[], in nextVal = PyObject_GetAttrString(currentVal, currentKey); exc = PyErr_Occurred(); if (exc != NULL) { - // if exception == AttributeError + // if exception == AttributeError, report our own exception if (PyErr_ExceptionMatches(PyExc_AttributeError)) { setNotFoundException(currentKey, currentVal); - if (i > 0) { - Py_DECREF(currentVal); - } - return NULL; } + // any exceptions results in failure + if (i > 0) { + Py_DECREF(currentVal); + } + return NULL; } } if (i > 0) { |