Skip to content

Commit 231fc35

Browse files
author
martin.v.loewis
committed
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. ........ git-svn-id: http://svn.python.org/projects/python/branches/py3k@68175 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 758aa03 commit 231fc35

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ What's New in Python 3.1 alpha 0
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #4075: Use OutputDebugStringW in Py_FatalError.
16+
1517
- Issue #4747: When the terminal does not use utf-8, executing a script with
1618
non-ascii characters in its name could fail with a "SyntaxError: None" error.
1719

@@ -175,6 +177,8 @@ Tools/Demos
175177
Extension Modules
176178
-----------------
177179

180+
- Issue #4051: Prevent conflict of UNICODE macros in cPickle.
181+
178182
- Issue #4738: Each zlib object now has a separate lock, allowing to compress
179183
or decompress several streams at once on multi-CPU systems. Also, the GIL
180184
is now released when computing the CRC of a large buffer. Patch by ebfe.

Python/pythonrun.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <signal.h>
2424
#endif
2525

26+
#include "malloc.h" /* for alloca */
27+
2628
#ifdef HAVE_LANGINFO_H
2729
#include <locale.h>
2830
#include <langinfo.h>
@@ -1918,9 +1920,21 @@ Py_FatalError(const char *msg)
19181920
PyErr_Print();
19191921
}
19201922
#ifdef MS_WINDOWS
1921-
OutputDebugString("Fatal Python error: ");
1922-
OutputDebugString(msg);
1923-
OutputDebugString("\n");
1923+
{
1924+
size_t len = strlen(msg);
1925+
WCHAR* buffer;
1926+
size_t i;
1927+
1928+
/* Convert the message to wchar_t. This uses a simple one-to-one
1929+
conversion, assuming that the this error message actually uses ASCII
1930+
only. If this ceases to be true, we will have to convert. */
1931+
buffer = alloca( (len+1) * (sizeof *buffer));
1932+
for( i=0; i<=len; ++i)
1933+
buffer[i] = msg[i];
1934+
OutputDebugStringW(L"Fatal Python error: ");
1935+
OutputDebugStringW(buffer);
1936+
OutputDebugStringW(L"\n");
1937+
}
19241938
#ifdef _DEBUG
19251939
DebugBreak();
19261940
#endif

0 commit comments

Comments
 (0)