mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
Issue #3210: Revert C module changes and apply patch from Hirokazu Yamamoto instead
This commit is contained in:
parent
2914308214
commit
10215de1ba
2 changed files with 15 additions and 31 deletions
|
@ -862,13 +862,7 @@ class Popen(object):
|
||||||
# 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
|
||||||
|
@ -882,6 +876,11 @@ class Popen(object):
|
||||||
if errwrite is not None:
|
if errwrite is not None:
|
||||||
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