Skip to content

Commit

Permalink
Clear KeyError if necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Aug 27, 2015
1 parent 7b8e552 commit 703bb78
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions traits/ctraits.c
Expand Up @@ -1152,9 +1152,14 @@ _has_traits_trait ( has_traits_object * obj, PyObject * args ) {
if (dict != NULL) {
temp_delegate = (has_traits_object *) PyDict_GetItem(
dict, trait->delegate_name );
/* PyDict_GetItem returns a borrowed reference,
so we need to INCREF. */
Py_XINCREF( temp_delegate );
if (temp_delegate == NULL) {
PyErr_Clear();
}
else {
/* PyDict_GetItem returns a borrowed reference,
so we need to INCREF. */
Py_INCREF( temp_delegate );
}
}
if (temp_delegate == NULL) {
/* has_traits_getattro returns a new reference,
Expand Down

0 comments on commit 703bb78

Please sign in to comment.