diff --git a/panda/src/event/pythonTask.cxx b/panda/src/event/pythonTask.cxx index 2e2213eacc..d9ea12b2f2 100644 --- a/panda/src/event/pythonTask.cxx +++ b/panda/src/event/pythonTask.cxx @@ -364,7 +364,7 @@ __getattribute__(PyObject *self, PyObject *attr) const { // We consult the instance dict first, since the user may have overridden a // method or something. PyObject *item; - if (PyDict_GetItemRef(__dict__, attr, &item) > 0) { + if (PyDict_GetItemRef(__dict__, attr, &item) != 0) { return item; } diff --git a/panda/src/pgraph/nodePath_ext.cxx b/panda/src/pgraph/nodePath_ext.cxx index 060a96e44d..af3be290b7 100644 --- a/panda/src/pgraph/nodePath_ext.cxx +++ b/panda/src/pgraph/nodePath_ext.cxx @@ -56,10 +56,9 @@ PyObject *Extension:: __deepcopy__(PyObject *self, PyObject *memo) const { extern struct Dtool_PyTypedObject Dtool_NodePath; - // Borrowed reference. PyObject *dupe; - if (PyDict_GetItemRef(memo, self, &dupe) > 0) { - // Already in the memo dictionary. + if (PyDict_GetItemRef(memo, self, &dupe) != 0) { + // Already in the memo dictionary (or an error happened). return dupe; } diff --git a/panda/src/pgraph/pandaNode_ext.cxx b/panda/src/pgraph/pandaNode_ext.cxx index f1d25ed08e..34fc727832 100644 --- a/panda/src/pgraph/pandaNode_ext.cxx +++ b/panda/src/pgraph/pandaNode_ext.cxx @@ -46,10 +46,9 @@ PyObject *Extension:: __deepcopy__(PyObject *self, PyObject *memo) const { extern struct Dtool_PyTypedObject Dtool_PandaNode; - // Borrowed reference. PyObject *dupe; - if (PyDict_GetItemRef(memo, self, &dupe) > 0) { - // Already in the memo dictionary. + if (PyDict_GetItemRef(memo, self, &dupe) != 0) { + // Already in the memo dictionary (or an error happened). return dupe; }