Fixed a interpreter lock problem in the __eq__ and __ne__ methods in wxSize and etc.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-19 22:09:59 +00:00
parent bb722da782
commit 83609d6f72
5 changed files with 64 additions and 27 deletions

View File

@@ -368,22 +368,24 @@ public:
bool __eq__(PyObject* obj) {
wxColour tmp;
wxColour* ptr = &tmp;
if (obj == Py_None) return FALSE;
if (! wxColour_helper(obj, &ptr)) return FALSE;
if (obj == Py_None) return FALSE;
wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
if (! success) return FALSE;
return *self == *ptr;
}
bool __ne__(PyObject* obj) {
wxColour tmp;
wxColour* ptr = &tmp;
if (obj == Py_None) return TRUE;
if (! wxColour_helper(obj, &ptr)) return TRUE;
if (obj == Py_None) return TRUE;
wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
if (! success) return TRUE;
return *self != *ptr;
}
}
%pragma(python) addtoclass = "asTuple = Get
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxColour: ' + str(self.asTuple())
def __repr__(self): return 'wxColour:' + str(self.asTuple())
def __nonzero__(self): return self.Ok()
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()