summaryrefslogtreecommitdiffstats
path: root/PC/_subprocess.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-22 01:27:30 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-22 01:27:30 (GMT)
commit9d3b93ba305e8a83bf1cec5146def2078e40b1a5 (patch)
treed618d2ca564f2a027522b22491f4fec656fceb09 /PC/_subprocess.c
parentb84d723509d1b8c7e052f61117624627d334cf30 (diff)
downloadcpython-9d3b93ba305e8a83bf1cec5146def2078e40b1a5.zip
cpython-9d3b93ba305e8a83bf1cec5146def2078e40b1a5.tar.gz
cpython-9d3b93ba305e8a83bf1cec5146def2078e40b1a5.tar.bz2
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()
Diffstat (limited to 'PC/_subprocess.c')
-rw-r--r--PC/_subprocess.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index fdcc55b..93e51d3 100644
--- a/PC/_subprocess.c
+++ b/PC/_subprocess.c
@@ -419,14 +419,14 @@ sp_CreateProcess(PyObject* self, PyObject* args)
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 @@ sp_CreateProcess(PyObject* self, PyObject* args)
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 @@ sp_CreateProcess(PyObject* self, PyObject* args)
return NULL;
}
}
- else
+ else {
+ environment = NULL;
wenvironment = NULL;
+ }
Py_BEGIN_ALLOW_THREADS
result = CreateProcessW(application_name,