Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22342/com/win32com/src
Modified Files:
PyRecord.cpp
Log Message:
Remove __cmp__ and tp_compare slots and return Py_NotImplemented in
richcmp functions when faced with different types.
Index: PyRecord.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyRecord.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PyRecord.cpp 3 Jan 2009 05:50:50 -0000 1.15
--- PyRecord.cpp 4 Feb 2009 04:06:10 -0000 1.16
***************
*** 645,660 ****
PyObject *ret = NULL;
if (op != Py_EQ && op != Py_NE) {
! PyErr_SetString(PyExc_TypeError, "IIDs only compare equal or not equal");
! return NULL;
}
int success = op == Py_EQ ? TRUE : FALSE;
! if (self->ob_type != other->ob_type)
! return PyBool_FromLong(!success);
PyRecord *pyself = (PyRecord *)self;
PyRecord *pyother = (PyRecord *)other;
if (!pyself->pri->IsMatchingType(pyother->pri)) {
! // Not matching types, so must compare False.
! return PyBool_FromLong(!success);
}
// Need to do a recursive compare, as some elements may be pointers
--- 645,663 ----
PyObject *ret = NULL;
if (op != Py_EQ && op != Py_NE) {
! Py_INCREF(Py_NotImplemented);
! return Py_NotImplemented;
}
int success = op == Py_EQ ? TRUE : FALSE;
! if (self->ob_type != other->ob_type) {
! Py_INCREF(Py_NotImplemented);
! return Py_NotImplemented;
! }
PyRecord *pyself = (PyRecord *)self;
PyRecord *pyother = (PyRecord *)other;
if (!pyself->pri->IsMatchingType(pyother->pri)) {
! // Not matching types, so can't compare.
! Py_INCREF(Py_NotImplemented);
! return Py_NotImplemented;
}
// Need to do a recursive compare, as some elements may be pointers
|