[pywin32-checkins] pywin32/win32/src PyHANDLE.cpp,1.13,1.14
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-02-17 07:37:52
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25200/win32/src Modified Files: PyHANDLE.cpp Log Message: Use PyWinLong_AsVoidPtr for int handles Index: PyHANDLE.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyHANDLE.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyHANDLE.cpp 11 Jan 2007 13:13:48 -0000 1.13 --- PyHANDLE.cpp 17 Feb 2007 07:37:47 -0000 1.14 *************** *** 30,41 **** *pHANDLE = (HANDLE)(*pH); } else{ // Support integer objects for b/w compat. ! // Can't use PyLong_AsVoidPtr here, since it calls PyLong_AsLong. See ! // http://sourceforge.net/tracker/?func=detail&atid=105470&aid=1630863&group_id=5470 ! #ifdef _WIN64 ! *pHANDLE = (HANDLE)PyLong_AsLongLong(ob); ! #else ! *pHANDLE = (HANDLE)PyInt_AsLong(ob); ! #endif ! if ((*pHANDLE==(HANDLE)-1)&&PyErr_Occurred()){ PyErr_SetString(PyExc_TypeError, "The object is not a PyHANDLE object"); return FALSE; --- 30,35 ---- *pHANDLE = (HANDLE)(*pH); } else{ // Support integer objects for b/w compat. ! // treat int handles same a void pointers ! if (!PyWinLong_AsVoidPtr(ob, (void **)pHANDLE)){ PyErr_SetString(PyExc_TypeError, "The object is not a PyHANDLE object"); return FALSE; *************** *** 51,63 **** // For handles that aren't returned as PyHANDLE or a subclass thereof (HDC, HWND, etc). ! // Return as python ints or longs // ??? Maybe make this a macro to avoid extra function call ??? PyObject *PyWinLong_FromHANDLE(HANDLE h) { ! #ifdef _WIN64 ! return PyLong_FromLongLong((long long)h); ! #else ! return PyInt_FromLong((long)h); ! #endif } --- 45,53 ---- // For handles that aren't returned as PyHANDLE or a subclass thereof (HDC, HWND, etc). ! // Treated same as void pointers. // ??? Maybe make this a macro to avoid extra function call ??? PyObject *PyWinLong_FromHANDLE(HANDLE h) { ! return PyWinLong_FromVoidPtr(h); } |