diff --git a/Misc/NEWS b/Misc/NEWS index 3934928633a..a933540d879 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ What's New in Python 3.1 alpha 0 Core and Builtins ----------------- +- Issue #4075: Use OutputDebugStringW in Py_FatalError. + - Issue #4747: When the terminal does not use utf-8, executing a script with non-ascii characters in its name could fail with a "SyntaxError: None" error. @@ -175,6 +177,8 @@ Tools/Demos Extension Modules ----------------- +- Issue #4051: Prevent conflict of UNICODE macros in cPickle. + - Issue #4738: Each zlib object now has a separate lock, allowing to compress or decompress several streams at once on multi-CPU systems. Also, the GIL is now released when computing the CRC of a large buffer. Patch by ebfe. diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 04dabc5c788..a3cce33bed7 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -23,6 +23,8 @@ #include #endif +#include "malloc.h" /* for alloca */ + #ifdef HAVE_LANGINFO_H #include #include @@ -1918,9 +1920,21 @@ Py_FatalError(const char *msg) PyErr_Print(); } #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