[pywin32-checkins] pywin32/win32/src PyLARGE_INTEGER.cpp, 1.14, 1.15
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2009-01-13 22:54:15
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17207/src Modified Files: PyLARGE_INTEGER.cpp Log Message: Merge py3k LARGE_INTEGER fixes from py3k branch Index: PyLARGE_INTEGER.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyLARGE_INTEGER.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyLARGE_INTEGER.cpp 11 Dec 2008 00:46:31 -0000 1.14 --- PyLARGE_INTEGER.cpp 13 Jan 2009 22:54:09 -0000 1.15 *************** *** 48,51 **** --- 48,53 ---- BOOL PyWinObject_AsULARGE_INTEGER(PyObject *ob, ULARGE_INTEGER *pResult) { + #if (PY_VERSION_HEX < 0x03000000) + // py2k - ints and longs are different, and we assume 'int' is 32bits. if (PyInt_Check(ob)) { // 32 bit integer value. *************** *** 57,74 **** ULISet32(*pResult, x); return TRUE; ! } else if (PyLong_Check(ob)) { pResult->QuadPart=PyLong_AsUnsignedLongLong(ob); return !(pResult->QuadPart == (ULONGLONG) -1 && PyErr_Occurred()); - } else { - PyErr_Warn(PyExc_PendingDeprecationWarning, "Support for passing 2 integers to create a 64bit value is deprecated - pass a long instead"); - long hiVal, loVal; - if (!PyArg_ParseTuple(ob, "ll", &hiVal, &loVal)) { - PyErr_SetString(PyExc_TypeError, "ULARGE_INTEGER must be 'int', or '(int, int)'"); - return FALSE; - } - pResult->QuadPart = (((__int64)hiVal) << 32) | loVal; - return TRUE; } ! assert(0); // not reached. } --- 59,76 ---- ULISet32(*pResult, x); return TRUE; ! } ! #endif // py2k ! if (PyLong_Check(ob)) { pResult->QuadPart=PyLong_AsUnsignedLongLong(ob); return !(pResult->QuadPart == (ULONGLONG) -1 && PyErr_Occurred()); } ! long hiVal, loVal; ! if (!PyArg_ParseTuple(ob, "ll", &hiVal, &loVal)) { ! PyErr_SetString(PyExc_TypeError, "ULARGE_INTEGER must be 'int', or '(int, int)'"); ! return FALSE; ! } ! PyErr_Warn(PyExc_PendingDeprecationWarning, "Support for passing 2 integers to create a 64bit value is deprecated - pass a long instead"); ! pResult->QuadPart = (((__int64)hiVal) << 32) | loVal; ! return TRUE; } |