[pywin32-checkins] pywin32/win32/src PyHANDLE.cpp, 1.16.2.2, 1.16.2.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-10-01 13:19:23
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31609/win32/src Modified Files: Tag: py3k PyHANDLE.cpp Log Message: simplify PyHANDLE str() and print() Index: PyHANDLE.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyHANDLE.cpp,v retrieving revision 1.16.2.2 retrieving revision 1.16.2.3 diff -C2 -d -r1.16.2.2 -r1.16.2.3 *** PyHANDLE.cpp 29 Aug 2008 07:44:54 -0000 1.16.2.2 --- PyHANDLE.cpp 1 Oct 2008 13:19:14 -0000 1.16.2.3 *************** *** 322,327 **** int PyHANDLE::print(FILE *fp, int flags) { ! TCHAR resBuf[160]; ! wsprintf(resBuf, _T("<%hs at %Id (%Id)>"), GetTypeName(), this, m_handle); // ### ACK! Python uses a non-debug runtime. We can't use stream // ### functions when in DEBUG mode!! (we link against a different --- 322,327 ---- int PyHANDLE::print(FILE *fp, int flags) { ! WCHAR resBuf[160]; ! wsprintfW(resBuf, L"<%hs at %Id (%Id)>", GetTypeName(), this, m_handle); // ### ACK! Python uses a non-debug runtime. We can't use stream // ### functions when in DEBUG mode!! (we link against a different *************** *** 330,334 **** // ### - Double Ack - Always use the hack! //#ifdef _DEBUG ! PyObject *ob = PyString_FromTCHAR(resBuf); PyObject_Print(ob, fp, flags|Py_PRINT_RAW); Py_DECREF(ob); --- 330,334 ---- // ### - Double Ack - Always use the hack! //#ifdef _DEBUG ! PyObject *ob = PyUnicode_FromWideChar(resBuf, wcslen(resBuf)); PyObject_Print(ob, fp, flags|Py_PRINT_RAW); Py_DECREF(ob); *************** *** 343,353 **** PyObject * PyHANDLE::asStr(void) { ! char resBuf[160]; ! snprintf(resBuf, 160, "<%s:%Id>", GetTypeName(), m_handle); ! #if (PY_VERSION_HEX < 0x03000000) ! return PyString_FromString(resBuf); ! #else ! return PyUnicode_FromString(resBuf); ! #endif } --- 343,349 ---- PyObject * PyHANDLE::asStr(void) { ! WCHAR resBuf[160]; ! _snwprintf(resBuf, 160, L"<%s:%Id>", GetTypeName(), m_handle); ! return PyWinCoreString_FromString(resBuf); } |