mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Implement PYTHONNOERRORWINDOW.
This commit is contained in:
		
							parent
							
								
									ef0f129133
								
							
						
					
					
						commit
						945362cf97
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		|  | @ -9,11 +9,16 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #if defined(MS_WINDOWS) || defined(__CYGWIN__) | #if defined(MS_WINDOWS) || defined(__CYGWIN__) | ||||||
|  | #include <windows.h> | ||||||
| #ifdef HAVE_FCNTL_H | #ifdef HAVE_FCNTL_H | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifdef _MSC_VER | ||||||
|  | #include <crtdbg.h> | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS) | #if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS) | ||||||
| #define PYTHONHOMEHELP "<prefix>\\lib" | #define PYTHONHOMEHELP "<prefix>\\lib" | ||||||
| #else | #else | ||||||
|  | @ -323,6 +328,25 @@ Py_Main(int argc, char **argv) | ||||||
| 	    (p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0') | 	    (p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0') | ||||||
| 		unbuffered = 1; | 		unbuffered = 1; | ||||||
| 
 | 
 | ||||||
|  | #ifdef MS_WINDOWS | ||||||
|  | 	if ((p = Py_GETENV("PYTHONNOERRORWINDOW")) && *p != '\0') { | ||||||
|  | 		/* Disable all error windows created by the sytem
 | ||||||
|  | 		   or the CRT. */ | ||||||
|  | #if defined(_DEBUG) && defined(_MSC_VER) | ||||||
|  | 		int types[] = {_CRT_WARN, _CRT_ERROR, _CRT_ASSERT}; | ||||||
|  | 		int i; | ||||||
|  | 		for (i = 0; i < sizeof(types)/sizeof(types[0]); i++) { | ||||||
|  | 		    _CrtSetReportFile(types[i], _CRTDBG_FILE_STDERR); | ||||||
|  | 		    _CrtSetReportMode(types[i], _CRTDBG_MODE_FILE); | ||||||
|  | 		} | ||||||
|  | 		_set_error_mode(_OUT_TO_STDERR); | ||||||
|  | #endif | ||||||
|  | 		SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | | ||||||
|  | 			     SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); | ||||||
|  | 	} | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	if (command == NULL && module == NULL && _PyOS_optind < argc && | 	if (command == NULL && module == NULL && _PyOS_optind < argc && | ||||||
| 	    strcmp(argv[_PyOS_optind], "-") != 0) | 	    strcmp(argv[_PyOS_optind], "-") != 0) | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
| @rem Used by the buildbot "test" step. | @rem Used by the buildbot "test" step. | ||||||
| cd PCbuild | cd PCbuild | ||||||
|  | set PYTHONNOERRORWINDOW=1 | ||||||
| call rt.bat -d -q -uall -rw | call rt.bat -d -q -uall -rw | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Martin v. Löwis
						Martin v. Löwis