From d102536a99915e0a9477856a35169538ad396a29 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Fri, 3 Jan 2025 16:44:38 +0000 Subject: [PATCH] Fix warning messages from PyDict_GetItem --- traits/ctraits.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/traits/ctraits.c b/traits/ctraits.c index faf7c4996..4cea72912 100644 --- a/traits/ctraits.c +++ b/traits/ctraits.c @@ -3639,7 +3639,7 @@ validate_trait_map( PyObject *value) { PyObject *type_info = trait->py_validate; - if (PyDict_GetItem(PyTuple_GET_ITEM(type_info, 1), value) != NULL) { + if (PyDict_GetItemWithError(PyTuple_GET_ITEM(type_info, 1), value) != NULL) { Py_INCREF(value); return value; } @@ -4065,7 +4065,7 @@ validate_trait_complex( PyErr_Clear(); break; case 6: /* Mapped item check: */ - if (PyDict_GetItem(PyTuple_GET_ITEM(type_info, 1), value) + if (PyDict_GetItemWithError(PyTuple_GET_ITEM(type_info, 1), value) != NULL) { goto done; }