mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #3210: Revert C module changes and apply patch from Hirokazu Yamamoto instead
This commit is contained in:
		
							parent
							
								
									afdeca980d
								
							
						
					
					
						commit
						ad537f23e2
					
				
					 2 changed files with 15 additions and 31 deletions
				
			
		|  | @ -886,13 +886,7 @@ def _execute_child(self, args, executable, preexec_fn, close_fds, | ||||||
|                 # translate errno using _sys_errlist (or simliar), but |                 # translate errno using _sys_errlist (or simliar), but | ||||||
|                 # how can this be done from Python? |                 # how can this be done from Python? | ||||||
|                 raise WindowsError(*e.args) |                 raise WindowsError(*e.args) | ||||||
| 
 |             finally: | ||||||
|             # Retain the process handle, but close the thread handle |  | ||||||
|             self._child_created = True |  | ||||||
|             self._handle = hp |  | ||||||
|             self.pid = pid |  | ||||||
|             ht.Close() |  | ||||||
| 
 |  | ||||||
|                 # Child is launched. Close the parent's copy of those pipe |                 # Child is launched. Close the parent's copy of those pipe | ||||||
|                 # handles that only the child should have open.  You need |                 # handles that only the child should have open.  You need | ||||||
|                 # to make sure that no handles to the write end of the |                 # to make sure that no handles to the write end of the | ||||||
|  | @ -906,6 +900,11 @@ def _execute_child(self, args, executable, preexec_fn, close_fds, | ||||||
|                 if errwrite != -1: |                 if errwrite != -1: | ||||||
|                     errwrite.Close() |                     errwrite.Close() | ||||||
| 
 | 
 | ||||||
|  |             # Retain the process handle, but close the thread handle | ||||||
|  |             self._child_created = True | ||||||
|  |             self._handle = hp | ||||||
|  |             self.pid = pid | ||||||
|  |             ht.Close() | ||||||
| 
 | 
 | ||||||
|         def _internal_poll(self, _deadstate=None, |         def _internal_poll(self, _deadstate=None, | ||||||
|                 _WaitForSingleObject=_subprocess.WaitForSingleObject, |                 _WaitForSingleObject=_subprocess.WaitForSingleObject, | ||||||
|  |  | ||||||
|  | @ -429,7 +429,6 @@ sp_CreateProcess(PyObject* self, PyObject* args) | ||||||
|     PyObject* env_mapping; |     PyObject* env_mapping; | ||||||
|     Py_UNICODE* current_directory; |     Py_UNICODE* current_directory; | ||||||
|     PyObject* startup_info; |     PyObject* startup_info; | ||||||
|     DWORD error; |  | ||||||
| 
 | 
 | ||||||
|     if (! PyArg_ParseTuple(args, "ZZOOiiOZO:CreateProcess", |     if (! PyArg_ParseTuple(args, "ZZOOiiOZO:CreateProcess", | ||||||
|                            &application_name, |                            &application_name, | ||||||
|  | @ -479,22 +478,8 @@ sp_CreateProcess(PyObject* self, PyObject* args) | ||||||
| 
 | 
 | ||||||
|     Py_XDECREF(environment); |     Py_XDECREF(environment); | ||||||
| 
 | 
 | ||||||
|     if (! result) { |     if (! result) | ||||||
|         error = GetLastError(); |         return PyErr_SetFromWindowsErr(GetLastError()); | ||||||
|         if(si.hStdInput != INVALID_HANDLE_VALUE) { |  | ||||||
|             CloseHandle(si.hStdInput); |  | ||||||
|             si.hStdInput = INVALID_HANDLE_VALUE; |  | ||||||
|         } |  | ||||||
|         if(si.hStdOutput != INVALID_HANDLE_VALUE) { |  | ||||||
|             CloseHandle(si.hStdOutput); |  | ||||||
|             si.hStdOutput = INVALID_HANDLE_VALUE; |  | ||||||
|         } |  | ||||||
|         if(si.hStdError != INVALID_HANDLE_VALUE) { |  | ||||||
|             CloseHandle(si.hStdError); |  | ||||||
|             si.hStdError = INVALID_HANDLE_VALUE; |  | ||||||
|         } |  | ||||||
|         return PyErr_SetFromWindowsErr(error); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     return Py_BuildValue("NNii", |     return Py_BuildValue("NNii", | ||||||
|                          sp_handle_new(pi.hProcess), |                          sp_handle_new(pi.hProcess), | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tim Golden
						Tim Golden