File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99#endif
1010
1111#if defined(MS_WINDOWS ) || defined(__CYGWIN__ )
12+ #include <windows.h>
1213#ifdef HAVE_FCNTL_H
1314#include <fcntl.h>
1415#endif
1516#endif
1617
18+ #ifdef _MSC_VER
19+ #include <crtdbg.h>
20+ #endif
21+
1722#if (defined(PYOS_OS2 ) && !defined(PYCC_GCC )) || defined(MS_WINDOWS )
1823#define PYTHONHOMEHELP "<prefix>\\lib"
1924#else
@@ -323,6 +328,25 @@ Py_Main(int argc, char **argv)
323328 (p = Py_GETENV ("PYTHONUNBUFFERED" )) && * p != '\0' )
324329 unbuffered = 1 ;
325330
331+ #ifdef MS_WINDOWS
332+ if ((p = Py_GETENV ("PYTHONNOERRORWINDOW" )) && * p != '\0' ) {
333+ /* Disable all error windows created by the sytem
334+ or the CRT. */
335+ #if defined(_DEBUG ) && defined(_MSC_VER )
336+ int types [] = {_CRT_WARN , _CRT_ERROR , _CRT_ASSERT };
337+ int i ;
338+ for (i = 0 ; i < sizeof (types )/sizeof (types [0 ]); i ++ ) {
339+ _CrtSetReportFile (types [i ], _CRTDBG_FILE_STDERR );
340+ _CrtSetReportMode (types [i ], _CRTDBG_MODE_FILE );
341+ }
342+ _set_error_mode (_OUT_TO_STDERR );
343+ #endif
344+ SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
345+ SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX );
346+ }
347+ #endif
348+
349+
326350 if (command == NULL && module == NULL && _PyOS_optind < argc &&
327351 strcmp (argv [_PyOS_optind ], "-" ) != 0 )
328352 {
Original file line number Diff line number Diff line change 11@ rem Used by the buildbot "test" step.
22cd PCbuild
3+ set PYTHONNOERRORWINDOW = 1
34call rt.bat -d -q -uall -rw
You can’t perform that action at this time.
0 commit comments