[pywin32-checkins] pywin32/win32/src PyOVERLAPPED.cpp, 1.16, 1.17 PyWinObjects.h, 1.21, 1.22
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2009-02-15 00:43:15
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv357/src Modified Files: PyOVERLAPPED.cpp PyWinObjects.h Log Message: Move overlapped objects to rich comparisons to avoid py3.0.1 warnings. Index: PyWinObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinObjects.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PyWinObjects.h 8 Feb 2009 09:57:09 -0000 1.21 --- PyWinObjects.h 15 Feb 2009 00:43:10 -0000 1.22 *************** *** 103,110 **** /* Python support */ - int compare(PyObject *ob); - static void deallocFunc(PyObject *ob); ! static int compareFunc(PyObject *ob1, PyObject *ob2); static PyObject *getattro(PyObject *self, PyObject *obname); --- 103,108 ---- /* Python support */ static void deallocFunc(PyObject *ob); ! static PyObject *richcompareFunc(PyObject *ob, PyObject *other, int op); static PyObject *getattro(PyObject *self, PyObject *obname); Index: PyOVERLAPPED.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyOVERLAPPED.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PyOVERLAPPED.cpp 11 Dec 2008 00:25:40 -0000 1.16 --- PyOVERLAPPED.cpp 15 Feb 2009 00:43:10 -0000 1.17 *************** *** 72,77 **** 0, /* tp_getattr */ 0, /* tp_setattr */ ! // @pymeth __cmp__|Used when OVERLAPPED objects are compared. ! PyOVERLAPPED::compareFunc, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ --- 72,76 ---- 0, /* tp_getattr */ 0, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ *************** *** 88,92 **** 0, /* tp_traverse */ 0, /* tp_clear */ ! 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ --- 87,91 ---- 0, /* tp_traverse */ 0, /* tp_clear */ ! PyOVERLAPPED::richcompareFunc, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ *************** *** 147,159 **** } ! int PyOVERLAPPED::compare(PyObject *ob) ! { ! return memcmp(&m_overlapped, &((PyOVERLAPPED *)ob)->m_overlapped, sizeof(m_overlapped)); ! } ! ! // @pymethod int|PyOVERLAPPED|__cmp__|Used when objects are compared. ! int PyOVERLAPPED::compareFunc(PyObject *ob1, PyObject *ob2) { ! return ((PyOVERLAPPED *)ob1)->compare(ob2); } --- 146,169 ---- } ! PyObject *PyOVERLAPPED::richcompareFunc(PyObject *ob, PyObject *other, int op) { ! PyOVERLAPPED::sMyOverlapped *mine = &((PyOVERLAPPED *)ob)->m_overlapped; ! PyOVERLAPPED::sMyOverlapped *oother; ! if (PyOVERLAPPED_Check(other)) { ! oother = &((PyOVERLAPPED *)other)->m_overlapped; ! } else { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! BOOL e = memcmp(mine, oother, sizeof(*mine))==0; ! PyObject *ret; ! if (op==Py_EQ) ! ret = e ? Py_True : Py_False; ! else if (op==Py_NE) ! ret = !e ? Py_True : Py_False; ! else ! ret = Py_NotImplemented; ! Py_INCREF(ret); ! return ret; } |