summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-01-02 20:47:48 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2009-01-02 20:47:48 (GMT)
commit5c88d8178442af4d2ac9f42774bc9ab4c45e5751 (patch)
tree83b185a26a0266b70228ada4c6f663bb5371797f /Python
parent770b0be53eb8a0f518ada4c17ea07fc2bcb9d248 (diff)
downloadcpython-5c88d8178442af4d2ac9f42774bc9ab4c45e5751.zip
cpython-5c88d8178442af4d2ac9f42774bc9ab4c45e5751.tar.gz
cpython-5c88d8178442af4d2ac9f42774bc9ab4c45e5751.tar.bz2
Merged revisions 68172-68173 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68172 | martin.v.loewis | 2009-01-02 21:32:55 +0100 (Fr, 02 Jan 2009) | 2 lines Issue #4075: Use OutputDebugStringW in Py_FatalError. ........ r68173 | martin.v.loewis | 2009-01-02 21:40:14 +0100 (Fr, 02 Jan 2009) | 2 lines Issue #4051: Prevent conflict of UNICODE macros in cPickle. ........
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 04dabc5..a3cce33 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -23,6 +23,8 @@
#include <signal.h>
#endif
+#include "malloc.h" /* for alloca */
+
#ifdef HAVE_LANGINFO_H
#include <locale.h>
#include <langinfo.h>
@@ -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