| OLD | NEW |
| 1 | 1 |
| 2 /* Python interpreter top-level routines, including init/exit */ | 2 /* Python interpreter top-level routines, including init/exit */ |
| 3 | 3 |
| 4 #include "Python.h" | 4 #include "Python.h" |
| 5 | 5 |
| 6 #include "Python-ast.h" | 6 #include "Python-ast.h" |
| 7 #undef Yield /* undefine macro conflicting with winbase.h */ | 7 #undef Yield /* undefine macro conflicting with winbase.h */ |
| 8 #include "grammar.h" | 8 #include "grammar.h" |
| 9 #include "node.h" | 9 #include "node.h" |
| 10 #include "token.h" | 10 #include "token.h" |
| (...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 | 2079 |
| 2080 void | 2080 void |
| 2081 Py_FatalError(const char *msg) | 2081 Py_FatalError(const char *msg) |
| 2082 { | 2082 { |
| 2083 fprintf(stderr, "Fatal Python error: %s\n", msg); | 2083 fprintf(stderr, "Fatal Python error: %s\n", msg); |
| 2084 fflush(stderr); /* it helps in Windows debug build */ | 2084 fflush(stderr); /* it helps in Windows debug build */ |
| 2085 if (PyErr_Occurred()) { | 2085 if (PyErr_Occurred()) { |
| 2086 PyErr_PrintEx(0); | 2086 PyErr_PrintEx(0); |
| 2087 } | 2087 } |
| 2088 #ifdef MS_WINDOWS | 2088 #ifdef MS_WINDOWS |
| 2089 { | 2089 if (IsDebuggerPresent()) { |
| 2090 size_t len = strlen(msg); | 2090 size_t len = strlen(msg); |
| 2091 WCHAR* buffer; | 2091 WCHAR* buffer; |
| 2092 size_t i; | 2092 size_t i; |
| 2093 | 2093 |
| 2094 /* Convert the message to wchar_t. This uses a simple one-to-one | 2094 /* Convert the message to wchar_t. This uses a simple one-to-one |
| 2095 conversion, assuming that the this error message actually uses ASCII | 2095 conversion, assuming that the this error message actually uses ASCII |
| 2096 only. If this ceases to be true, we will have to convert. */ | 2096 only. If this ceases to be true, we will have to convert. */ |
| 2097 buffer = alloca( (len+1) * (sizeof *buffer)); | 2097 buffer = alloca( (len+1) * (sizeof *buffer)); |
| 2098 for( i=0; i<=len; ++i) | 2098 for( i=0; i<=len; ++i) |
| 2099 buffer[i] = msg[i]; | 2099 buffer[i] = msg[i]; |
| 2100 OutputDebugStringW(L"Fatal Python error: "); | 2100 OutputDebugStringW(L"Fatal Python error: "); |
| 2101 OutputDebugStringW(buffer); | 2101 OutputDebugStringW(buffer); |
| 2102 OutputDebugStringW(L"\n"); | 2102 OutputDebugStringW(L"\n"); |
| 2103 #ifdef _DEBUG |
| 2104 DebugBreak(); |
| 2105 #endif |
| 2103 } | 2106 } |
| 2104 #ifdef _DEBUG | |
| 2105 DebugBreak(); | |
| 2106 #endif | |
| 2107 #endif /* MS_WINDOWS */ | 2107 #endif /* MS_WINDOWS */ |
| 2108 abort(); | 2108 abort(); |
| 2109 } | 2109 } |
| 2110 | 2110 |
| 2111 /* Clean up and exit */ | 2111 /* Clean up and exit */ |
| 2112 | 2112 |
| 2113 #ifdef WITH_THREAD | 2113 #ifdef WITH_THREAD |
| 2114 #include "pythread.h" | 2114 #include "pythread.h" |
| 2115 #endif | 2115 #endif |
| 2116 | 2116 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 #undef PyRun_InteractiveLoop | 2454 #undef PyRun_InteractiveLoop |
| 2455 PyAPI_FUNC(int) | 2455 PyAPI_FUNC(int) |
| 2456 PyRun_InteractiveLoop(FILE *f, const char *p) | 2456 PyRun_InteractiveLoop(FILE *f, const char *p) |
| 2457 { | 2457 { |
| 2458 return PyRun_InteractiveLoopFlags(f, p, NULL); | 2458 return PyRun_InteractiveLoopFlags(f, p, NULL); |
| 2459 } | 2459 } |
| 2460 | 2460 |
| 2461 #ifdef __cplusplus | 2461 #ifdef __cplusplus |
| 2462 } | 2462 } |
| 2463 #endif | 2463 #endif |
| OLD | NEW |