Mercurial > cpython-lru_cache-weakref
diff PC/_subprocess.c @ 73683:d48b4a1c511a
Use the new Unicode API
* Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)
* Replce PyUnicode_FromUnicode(str, len) by PyUnicode_FromWideChar(str, len)
* Replace Py_UNICODE by wchar_t
* posix_putenv() uses PyUnicode_FromFormat() to create the string, instead
of PyUnicode_FromUnicode() + _snwprintf()
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Tue, 22 Nov 2011 02:27:30 +0100 |
| parents | da608aa6f59e |
| children | f452d7d5470d |
line wrap: on
line diff
--- a/PC/_subprocess.c Tue Nov 22 01:50:07 2011 +0100 +++ b/PC/_subprocess.c Tue Nov 22 02:27:30 2011 +0100 @@ -419,14 +419,14 @@ PyObject* environment; wchar_t *wenvironment; - Py_UNICODE* application_name; - Py_UNICODE* command_line; + wchar_t* application_name; + wchar_t* command_line; PyObject* process_attributes; /* ignored */ PyObject* thread_attributes; /* ignored */ int inherit_handles; int creation_flags; PyObject* env_mapping; - Py_UNICODE* current_directory; + wchar_t* current_directory; PyObject* startup_info; if (! PyArg_ParseTuple(args, "ZZOOiiOZO:CreateProcess", @@ -454,15 +454,10 @@ if (PyErr_Occurred()) return NULL; - if (env_mapping == Py_None) - environment = NULL; - else { + if (env_mapping != Py_None) { environment = getenvironment(env_mapping); if (! environment) return NULL; - } - - if (environment) { wenvironment = PyUnicode_AsUnicode(environment); if (wenvironment == NULL) { @@ -470,8 +465,10 @@ return NULL; } } - else + else { + environment = NULL; wenvironment = NULL; + } Py_BEGIN_ALLOW_THREADS result = CreateProcessW(application_name,
