Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/src
Modified Files:
Tag: py3k
ErrorUtils.cpp PyIDispatch.cpp PyIUnknown.cpp
Log Message:
Merge various changes from trunk and py3k-integration bzr branch
Index: ErrorUtils.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v
retrieving revision 1.30.2.3
retrieving revision 1.30.2.4
diff -C2 -d -r1.30.2.3 -r1.30.2.4
*** ErrorUtils.cpp 13 Sep 2008 04:26:17 -0000 1.30.2.3
--- ErrorUtils.cpp 26 Nov 2008 07:17:39 -0000 1.30.2.4
***************
*** 184,191 ****
// Note that with class based exceptions, a simple pointer check fails.
// Any class sub-classed from the client is considered a server error,
! // so we need to check the class explicitely.
! if (v==PyWinExc_COMError || // String exceptions
! (PyObject_IsInstance(v, PyExc_Exception) && // Class exceptions
! ((PyObject *)v->ob_type==PyWinExc_COMError))) {
// Client side error
// Clear the state of the excep info.
--- 184,189 ----
// Note that with class based exceptions, a simple pointer check fails.
// Any class sub-classed from the client is considered a server error,
! // so we need to check the class explicitly.
! if ((PyObject *)v->ob_type==PyWinExc_COMError) {
// Client side error
// Clear the state of the excep info.
***************
*** 496,508 ****
}
! BOOL IsNonServerErrorCurrent() {
BOOL rc = FALSE;
PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL;
PyErr_Fetch( &exc_typ, &exc_val, &exc_tb);
if (exc_typ) {
PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb);
! rc = (!PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) ||
! (PyObject_IsInstance(exc_val, PyExc_Exception) &&
! PyObject_IsSubclass((PyObject *)exc_val->ob_type, PyWinExc_COMError)));
}
PyErr_Restore(exc_typ, exc_val, exc_tb);
--- 494,511 ----
}
! // Is the current exception a "server" exception? - ie, one explicitly
! // thrown by Python code to indicate an error. This is defined as
! // any exception whose type is a subclass of com_error (a plain
! // com_error probably means an unhandled exception from someone
! // calling an interface)
! BOOL IsServerErrorCurrent() {
BOOL rc = FALSE;
PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL;
PyErr_Fetch( &exc_typ, &exc_val, &exc_tb);
+ assert(exc_typ); // we should only be called with an exception current.
if (exc_typ) {
PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb);
! // so it must "match" a com_error, but not be *exactly* a COM error.
! rc = PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) && exc_typ != PyWinExc_COMError;
}
PyErr_Restore(exc_typ, exc_val, exc_tb);
***************
*** 527,531 ****
void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...)
{
! if (!IsNonServerErrorCurrent())
return;
va_list marker;
--- 530,534 ----
void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...)
{
! if (IsServerErrorCurrent())
return;
va_list marker;
***************
*** 726,730 ****
--- 729,735 ----
//
////////////////////////////////////////////////////////////////////////
+ #ifndef _countof
#define _countof(array) (sizeof(array)/sizeof(array[0]))
+ #endif
void GetScodeString(HRESULT hr, LPTSTR buf, int bufSize)
Index: PyIUnknown.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIUnknown.cpp,v
retrieving revision 1.12.2.3
retrieving revision 1.12.2.4
diff -C2 -d -r1.12.2.3 -r1.12.2.4
*** PyIUnknown.cpp 13 Sep 2008 04:26:17 -0000 1.12.2.3
--- PyIUnknown.cpp 26 Nov 2008 07:17:39 -0000 1.12.2.4
***************
*** 209,213 ****
return NULL;
! IID useIID; /* used if obUseIID != NULL */
// This used to allow an int, with 1 indicating IUnknown
--- 209,213 ----
return NULL;
! IID useIID; /* used if obUseIID != Py_None */
// This used to allow an int, with 1 indicating IUnknown
***************
*** 236,240 ****
/* we may have been asked to use a different interface */
! /* ??? useIID will be ignored if interface successfully created ??? */
if ( rc == NULL && obUseIID != Py_None)
{
--- 236,242 ----
/* we may have been asked to use a different interface */
! /* ??? useIID will be ignored if interface successfully created ???
! Apparently true and relies on a final QI somewhere? :()
! */
if ( rc == NULL && obUseIID != Py_None)
{
Index: PyIDispatch.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIDispatch.cpp,v
retrieving revision 1.11.4.1
retrieving revision 1.11.4.2
diff -C2 -d -r1.11.4.1 -r1.11.4.2
*** PyIDispatch.cpp 29 Aug 2008 08:27:37 -0000 1.11.4.1
--- PyIDispatch.cpp 26 Nov 2008 07:17:39 -0000 1.11.4.2
***************
*** 60,64 ****
return PyErr_Format(PyExc_TypeError, "At least one argument must be supplied");
! LCID lcid;
UINT offset = 0;
if ( argc > 1 ){
--- 60,64 ----
return PyErr_Format(PyExc_TypeError, "At least one argument must be supplied");
! LCID lcid = LOCALE_SYSTEM_DEFAULT;
UINT offset = 0;
if ( argc > 1 ){
|