Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17475
Modified Files:
oleargs.cpp
Log Message:
* Prevent PyCom_MakeOlePythonCall(), which is called by pythonwin's OCX
support from doing evil things if a result tuple is too small.
* When a byref bool is required, return either VARIANT_TRUE (-1) or
VARIANT_FALSE (0), not simply the integer value (which would be 1 if
True was passed)
Index: oleargs.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** oleargs.cpp 27 Aug 2007 08:38:43 -0000 1.39
--- oleargs.cpp 11 Sep 2007 08:55:20 -0000 1.40
***************
*** 1222,1226 ****
if (!VALID_BYREF_MISSING(obj)) {
if ((obUse=PyNumber_Int(obj))==NULL) BREAK_FALSE
! *MYBOOLREF = (VARIANT_BOOL)PyInt_AsLong(obj);
} else
*MYBOOLREF = 0;
--- 1222,1226 ----
if (!VALID_BYREF_MISSING(obj)) {
if ((obUse=PyNumber_Int(obj))==NULL) BREAK_FALSE
! *MYBOOLREF = PyInt_AsLong(obj) ? VARIANT_TRUE : VARIANT_FALSE;
} else
*MYBOOLREF = 0;
***************
*** 1414,1424 ****
// make the return type
PyObject *simpleRet;
! if (PyTuple_Check(result)) {
simpleRet = PyTuple_GetItem(result, 0);
int retNumber = 1;
! int retTotal = PyTuple_Size(result)-1;
// Params are reverse order - loop from the back.
! for (unsigned int param=params->cArgs;param!=0;param--) {
if (pHelpers[param-1].m_bIsOut) {
PyObject *val = PyTuple_GetItem(result, retNumber);
--- 1414,1424 ----
// make the return type
PyObject *simpleRet;
! if (PyTuple_Check(result) && PyTuple_Size(result)) {
simpleRet = PyTuple_GetItem(result, 0);
int retNumber = 1;
! int retTotal = PyTuple_Size(result);
// Params are reverse order - loop from the back.
! for (unsigned int param=params->cArgs;param!=0 && retNumber < retTotal;param--) {
if (pHelpers[param-1].m_bIsOut) {
PyObject *val = PyTuple_GetItem(result, retNumber);
|