diff options
author | Christian Heimes <christian@cheimes.de> | 2008-05-26 12:51:38 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-05-26 12:51:38 (GMT) |
commit | 593daf545bd9b7e7bcb27b498ecc6f36db9ae395 (patch) | |
tree | c0a57029b9ab0eb18a2bb4f8fd65f0817f1a1707 /PC/_subprocess.c | |
parent | c3cb683d638e9d660c18a05293a576f98965166e (diff) | |
download | cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.zip cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.tar.gz cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.tar.bz2 |
Renamed PyString to PyBytes
Diffstat (limited to 'PC/_subprocess.c')
-rw-r--r-- | PC/_subprocess.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c index c93f84b..60f3bfe 100644 --- a/PC/_subprocess.c +++ b/PC/_subprocess.c @@ -304,42 +304,42 @@ getenvironment(PyObject* environment) if (!keys || !values) goto error; - out = PyString_FromStringAndSize(NULL, 2048); + out = PyBytes_FromStringAndSize(NULL, 2048); if (! out) goto error; - p = PyString_AS_STRING(out); + p = PyBytes_AS_STRING(out); for (i = 0; i < envsize; i++) { int ksize, vsize, totalsize; PyObject* key = PyList_GET_ITEM(keys, i); PyObject* value = PyList_GET_ITEM(values, i); - if (! PyString_Check(key) || ! PyString_Check(value)) { + if (! PyBytes_Check(key) || ! PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "environment can only contain strings"); goto error; } - ksize = PyString_GET_SIZE(key); - vsize = PyString_GET_SIZE(value); - totalsize = (p - PyString_AS_STRING(out)) + ksize + 1 + + ksize = PyBytes_GET_SIZE(key); + vsize = PyBytes_GET_SIZE(value); + totalsize = (p - PyBytes_AS_STRING(out)) + ksize + 1 + vsize + 1 + 1; - if (totalsize > PyString_GET_SIZE(out)) { - int offset = p - PyString_AS_STRING(out); - _PyString_Resize(&out, totalsize + 1024); - p = PyString_AS_STRING(out) + offset; + if (totalsize > PyBytes_GET_SIZE(out)) { + int offset = p - PyBytes_AS_STRING(out); + _PyBytes_Resize(&out, totalsize + 1024); + p = PyBytes_AS_STRING(out) + offset; } - memcpy(p, PyString_AS_STRING(key), ksize); + memcpy(p, PyBytes_AS_STRING(key), ksize); p += ksize; *p++ = '='; - memcpy(p, PyString_AS_STRING(value), vsize); + memcpy(p, PyBytes_AS_STRING(value), vsize); p += vsize; *p++ = '\0'; } /* add trailing null byte */ *p++ = '\0'; - _PyString_Resize(&out, p - PyString_AS_STRING(out)); + _PyBytes_Resize(&out, p - PyBytes_AS_STRING(out)); /* PyObject_Print(out, stdout, 0); */ @@ -413,7 +413,7 @@ sp_CreateProcess(PyObject* self, PyObject* args) NULL, inherit_handles, creation_flags, - environment ? PyString_AS_STRING(environment) : NULL, + environment ? PyBytes_AS_STRING(environment) : NULL, current_directory, &si, &pi); @@ -516,7 +516,7 @@ sp_GetModuleFileName(PyObject* self, PyObject* args) if (! result) return PyErr_SetFromWindowsErr(GetLastError()); - return PyString_FromString(filename); + return PyBytes_FromString(filename); } static PyMethodDef sp_functions[] = { |