Index: pythonrun.c =================================================================== --- pythonrun.c (revision 66844) +++ pythonrun.c (working copy) @@ -22,6 +22,8 @@ #include #endif +#include "malloc.h" /* for alloca */ + #ifdef HAVE_LANGINFO_H #include #include @@ -1622,9 +1624,21 @@ { fprintf(stderr, "Fatal Python error: %s\n", msg); #ifdef MS_WINDOWS - OutputDebugString("Fatal Python error: "); - OutputDebugString(msg); - OutputDebugString("\n"); + { + size_t len = strlen(msg); + WCHAR* buffer; + size_t i; + + /* Convert the message to wchar_t. This uses a simple one-to-one + conversion, assuming that the this error message actually uses ASCII + only. If this ceases to be true, we will have to convert. */ + buffer = alloca( (len+1) * (sizeof *buffer)); + for( i=0; i<=len; ++i) + buffer[i] = msg[i]; + OutputDebugStringW(L"Fatal Python error: "); + OutputDebugStringW(buffer); + OutputDebugStringW(L"\n"); + } #ifdef _DEBUG DebugBreak(); #endif