comparison Python/pythonrun.c @ 50558:fbf7f53f4888 3.0

Merged revisions 68175 via svnmerge from svn+ssh://svn.python.org/python/branches/py3k ................ r68175 | martin.v.loewis | 2009-01-02 21:47:48 +0100 (Fri, 02 Jan 2009) | 13 lines 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. ........ ................
author Georg Brandl <georg@python.org>
date Sat, 03 Jan 2009 23:58:58 +0000
parents 630c174b465e
children 6f30b97148b6
comparison
equal deleted inserted replaced
50557:bd0e361bd642 50558:fbf7f53f4888
20 #include "osdefs.h" 20 #include "osdefs.h"
21 21
22 #ifdef HAVE_SIGNAL_H 22 #ifdef HAVE_SIGNAL_H
23 #include <signal.h> 23 #include <signal.h>
24 #endif 24 #endif
25
26 #include "malloc.h" /* for alloca */
25 27
26 #ifdef HAVE_LANGINFO_H 28 #ifdef HAVE_LANGINFO_H
27 #include <locale.h> 29 #include <locale.h>
28 #include <langinfo.h> 30 #include <langinfo.h>
29 #endif 31 #endif
1916 fprintf(stderr, "Fatal Python error: %s\n", msg); 1918 fprintf(stderr, "Fatal Python error: %s\n", msg);
1917 if (PyErr_Occurred()) { 1919 if (PyErr_Occurred()) {
1918 PyErr_Print(); 1920 PyErr_Print();
1919 } 1921 }
1920 #ifdef MS_WINDOWS 1922 #ifdef MS_WINDOWS
1921 OutputDebugString("Fatal Python error: "); 1923 {
1922 OutputDebugString(msg); 1924 size_t len = strlen(msg);
1923 OutputDebugString("\n"); 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 }
1924 #ifdef _DEBUG 1938 #ifdef _DEBUG
1925 DebugBreak(); 1939 DebugBreak();
1926 #endif 1940 #endif
1927 #endif /* MS_WINDOWS */ 1941 #endif /* MS_WINDOWS */
1928 abort(); 1942 abort();