Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1:/tmp/cvs-serv20823
Modified Files:
ErrorUtils.cpp
Log Message:
If we fail to write to sys.stderr, fprintf to stderr and restore the
Python exception state.
Index: ErrorUtils.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ErrorUtils.cpp 10 Jan 2003 02:42:46 -0000 1.18
--- ErrorUtils.cpp 23 Oct 2003 06:17:49 -0000 1.19
***************
*** 439,445 ****
// PySys_WriteStderr has an internal 1024 limit due to varargs.
// weve already resolved them, so we gotta do it the hard way
PyObject *pyfile = PySys_GetObject("stderr");
if (pyfile)
! PyFile_WriteString((char *)pszMessageText, pyfile);
}
--- 439,451 ----
// PySys_WriteStderr has an internal 1024 limit due to varargs.
// weve already resolved them, so we gotta do it the hard way
+ // We can't afford to screw with the Python exception state
+ PyObject *typ, *val, *tb;
+ PyErr_Fetch(&typ, &val, &tb);
PyObject *pyfile = PySys_GetObject("stderr");
if (pyfile)
! if (PyFile_WriteString((char *)pszMessageText, pyfile)!=0)
! // eeek - Python error writing this error - write it to stdout.
! fprintf(stdout, "%s", pszMessageText);
! PyErr_Restore(typ, val, tb);
}
|