[pywin32-checkins] pywin32/com/win32com/src oleargs.cpp, 1.41.2.2, 1.41.2.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-13 13:31:19
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27646 Modified Files: Tag: py3k oleargs.cpp Log Message: Return unicode from OleSetTypeError Index: oleargs.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v retrieving revision 1.41.2.2 retrieving revision 1.41.2.3 diff -C2 -d -r1.41.2.2 -r1.41.2.3 *** oleargs.cpp 13 Sep 2008 04:26:18 -0000 1.41.2.2 --- oleargs.cpp 13 Sep 2008 13:31:28 -0000 1.41.2.3 *************** *** 17,32 **** // A little helper just for this file ! static PyObject* OleSetTypeError(char *msg) ! { ! PyErr_SetString(PyExc_TypeError, msg); ! return NULL; ! } ! ! #ifdef UNICODE ! // In a Unicode environment, we provide a helper that ! // converts the argument to a string before raising the error. ! static PyObject* OleSetTypeErrorW(TCHAR *msg) { ! PyObject *obMsg = PyString_FromUnicode(msg); if (obMsg) { PyErr_SetObject(PyExc_TypeError, obMsg); --- 17,23 ---- // A little helper just for this file ! static PyObject* OleSetTypeError(TCHAR *msg) { ! PyObject *obMsg = PyWinObject_FromTCHAR(msg); if (obMsg) { PyErr_SetObject(PyExc_TypeError, obMsg); *************** *** 35,42 **** return NULL; } - #define OleSetTypeErrorT OleSetTypeErrorW - #else - #define OleSetTypeErrorT OleSetTypeError - #endif /////////////////////////////////////////////////////////// --- 26,29 ---- *************** *** 229,233 **** /* ### note: we shouldn't see this, it is illegal in a VARIANT */ if (V_ISVECTOR(var)) { ! return OleSetTypeError("Cant convert vectors!"); } --- 216,220 ---- /* ### note: we shouldn't see this, it is illegal in a VARIANT */ if (V_ISVECTOR(var)) { ! return OleSetTypeError(_T("Cant convert vectors!")); } *************** *** 267,271 **** TCHAR buf[200]; wsprintf(buf, _T("Error converting integer variant (%08lx)"), hr); ! OleSetTypeErrorT(buf); break; } --- 254,258 ---- TCHAR buf[200]; wsprintf(buf, _T("Error converting integer variant (%08lx)"), hr); ! OleSetTypeError(buf); break; } *************** *** 287,291 **** TCHAR buf[200]; wsprintf(buf, _T("Error converting integer variant (%08lx)"), hr); ! OleSetTypeErrorT(buf); break; } --- 274,278 ---- TCHAR buf[200]; wsprintf(buf, _T("Error converting integer variant (%08lx)"), hr); ! OleSetTypeError(buf); break; } *************** *** 305,309 **** TCHAR buf[200]; wsprintf(buf, _T("Error converting floating point variant (%08lx)"), hr); ! OleSetTypeErrorT(buf); break; } --- 292,296 ---- TCHAR buf[200]; wsprintf(buf, _T("Error converting floating point variant (%08lx)"), hr); ! OleSetTypeError(buf); break; } *************** *** 368,372 **** TCHAR buf[200]; wsprintf(buf, _T("The Variant type (0x%x) is not supported, and it can not be converted to a string"), V_VT(var)); ! OleSetTypeErrorT(buf); break; } --- 355,359 ---- TCHAR buf[200]; wsprintf(buf, _T("The Variant type (0x%x) is not supported, and it can not be converted to a string"), V_VT(var)); ! OleSetTypeError(buf); break; } *************** *** 390,394 **** LONG numElements = pBounds[dimNo-1].cElements; if ((LONG)PySequence_Length(obj)!=numElements) { ! OleSetTypeError("All dimensions must be a sequence of the same size"); return FALSE; } --- 377,381 ---- LONG numElements = pBounds[dimNo-1].cElements; if ((LONG)PySequence_Length(obj)!=numElements) { ! OleSetTypeError(_T("All dimensions must be a sequence of the same size")); return FALSE; } *************** *** 403,407 **** if (bufSize != numElements) { ! OleSetTypeError("Internal error - the buffer length is not the sequence length!"); return FALSE; } --- 390,394 ---- if (bufSize != numElements) { ! OleSetTypeError(_T("Internal error - the buffer length is not the sequence length!")); return FALSE; } *************** *** 434,438 **** // Complex conversion. if (vt & VT_ARRAY || vt & VT_BYREF) { ! OleSetTypeError("Internal error - unexpected argument - only simple VARIANTTYPE expected"); ok = FALSE; } else { --- 421,425 ---- // Complex conversion. if (vt & VT_ARRAY || vt & VT_BYREF) { ! OleSetTypeError(_T("Internal error - unexpected argument - only simple VARIANTTYPE expected")); ok = FALSE; } else { *************** *** 595,599 **** if (cDims==0) { ! OleSetTypeError("Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object."); return FALSE; } --- 582,586 ---- if (cDims==0) { ! OleSetTypeError(_T("Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object.")); return FALSE; } *************** *** 802,806 **** TCHAR buf[200]; wsprintf(buf, _T("The VARIANT type 0x%x is not supported for SAFEARRAYS"), vt); ! OleSetTypeErrorT(buf); } } --- 789,793 ---- TCHAR buf[200]; wsprintf(buf, _T("The VARIANT type 0x%x is not supported for SAFEARRAYS"), vt); ! OleSetTypeError(buf); } } *************** *** 891,895 **** // Our caller must has resolved all byref and array references. if (vt & VT_ARRAY || vt & VT_BYREF) { ! OleSetTypeError("Internal error - unexpected argument - only simple VARIANTTYPE expected"); return FALSE; } --- 878,882 ---- // Our caller must has resolved all byref and array references. if (vt & VT_ARRAY || vt & VT_BYREF) { ! OleSetTypeError(_T("Internal error - unexpected argument - only simple VARIANTTYPE expected")); return FALSE; } *************** *** 1051,1055 **** } if (m_reqdType & VT_VECTOR) { // we have been asked for an array. ! OleSetTypeError("Sorry - cant support VT_VECTOR arguments"); return FALSE; } --- 1038,1042 ---- } if (m_reqdType & VT_VECTOR) { // we have been asked for an array. ! OleSetTypeError(_T("Sorry - cant support VT_VECTOR arguments")); return FALSE; } *************** *** 1338,1342 **** TCHAR buf[200]; wsprintf(buf, _T("The VARIANT type is unknown (0x%08lx)"), m_reqdType); ! OleSetTypeErrorT(buf); rc = FALSE; break; --- 1325,1329 ---- TCHAR buf[200]; wsprintf(buf, _T("The VARIANT type is unknown (0x%08lx)"), m_reqdType); ! OleSetTypeError(buf); rc = FALSE; break; |