From 4012e27c14174ef47212ac16e0bb65d7abe6f791 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 17 Nov 2017 14:45:01 -0800 Subject: [PATCH] Fix __eq__ and __ne__ for comparing TreeListItem with None --- etg/treelist.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/etg/treelist.py b/etg/treelist.py index 7fb30971..ea6cc859 100644 --- a/etg/treelist.py +++ b/etg/treelist.py @@ -51,9 +51,10 @@ def run(): return (long)self->GetID(); """) - c.addCppMethod('bool', '__eq__', '(wxTreeListItem* other)', "return (self->GetID() == other->GetID());") - c.addCppMethod('bool', '__ne__', '(wxTreeListItem* other)', "return (self->GetID() != other->GetID());") - + c.addCppMethod('bool', '__eq__', '(wxTreeListItem* other)', + "return other ? (self->GetID() == other->GetID()) : false;") + c.addCppMethod('bool', '__ne__', '(wxTreeListItem* other)', + "return other ? (self->GetID() != other->GetID()) : true;") #----------------------------------------------------------------- c = module.find('wxTreeListItemComparator')