[pywin32-checkins] pywin32/win32/src PySID.cpp, 1.16, 1.17 PySecurityObjects.h, 1.15, 1.16
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: Mark H. <mha...@us...> - 2009-02-04 04:04:28
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22042/win32/src Modified Files: PySID.cpp PySecurityObjects.h Log Message: Remove __cmp__ and tp_compare slots from PySIDs and return Py_NotImplemented in richcmp functions when faced with different types. Index: PySID.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PySID.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PySID.cpp 25 Jan 2009 03:16:35 -0000 1.16 --- PySID.cpp 4 Feb 2009 04:04:20 -0000 1.17 *************** *** 244,249 **** 0, /* tp_getattr */ 0, /* tp_setattr */ ! // @pymeth __cmp__|Used when objects are compared. ! PySID::compareFunc, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ --- 244,248 ---- 0, /* tp_getattr */ 0, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ *************** *** 306,324 **** } - int PySID::compare(PyObject *ob) - { - PSID p2; - if (!PyWinObject_AsSID(ob, &p2, FALSE)) - return -2; - return EqualSid(this->GetSID(), p2)==FALSE; - } - PyObject *PySID::richcompare(PyObject *other, int op) { ! BOOL e; ! if (PySID_Check(other)) ! e=compare((PyHANDLE *)other)==0; ! else ! e=FALSE; PyObject *ret; if (op==Py_EQ) --- 305,318 ---- } PyObject *PySID::richcompare(PyObject *other, int op) { ! if (!PySID_Check(other)) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! PSID p2; ! if (!PyWinObject_AsSID(other, &p2, FALSE)) ! return NULL; ! BOOL e = EqualSid(GetSID(), p2); PyObject *ret; if (op==Py_EQ) *************** *** 326,344 **** else if (op==Py_NE) ret = !e ? Py_True : Py_False; ! else { ! PyErr_SetString(PyExc_TypeError, "SIDs only compare equal or not equal"); ! ret = NULL; ! } ! Py_XINCREF(ret); return ret; } - // @pymethod int|PySID|__cmp__|Used when objects are compared. - // @comm This method calls the Win32 API function EqualSid - int PySID::compareFunc(PyObject *ob1, PyObject *ob2) - { - return ((PySID *)ob1)->compare(ob2); - } - PyObject *PySID::richcompareFunc(PyObject *ob1, PyObject *ob2, int op) { --- 320,329 ---- else if (op==Py_NE) ret = !e ? Py_True : Py_False; ! else ! ret = Py_NotImplemented; ! Py_INCREF(ret); return ret; } PyObject *PySID::richcompareFunc(PyObject *ob1, PyObject *ob2, int op) { Index: PySecurityObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PySecurityObjects.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PySecurityObjects.h 25 Jan 2009 03:16:35 -0000 1.15 --- PySecurityObjects.h 4 Feb 2009 04:04:20 -0000 1.16 *************** *** 101,109 **** /* Python support */ - int compare(PyObject *ob); PyObject *richcompare(PyObject *other, int op); static void deallocFunc(PyObject *ob); - static int compareFunc(PyObject *ob1, PyObject *ob2); static PyObject *richcompareFunc(PyObject *ob1, PyObject *ob2, int op); static PyObject *strFunc(PyObject *ob); --- 101,107 ---- |