summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
Diffstat (limited to 'PC')
-rw-r--r--PC/_msi.c12
-rw-r--r--PC/_subprocess.c30
-rw-r--r--PC/_winreg.c40
-rwxr-xr-xPC/msvcrtmodule.c4
-rw-r--r--PC/winsound.c2
5 files changed, 44 insertions, 44 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index dfbdf3b..fd6fc5d 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -35,7 +35,7 @@ uuidcreate(PyObject* obj, PyObject*args)
return NULL;
}
- oresult = PyString_FromString(cresult);
+ oresult = PyBytes_FromString(cresult);
RpcStringFree(&cresult);
return oresult;
@@ -136,14 +136,14 @@ static FNFCIGETNEXTCABINET(cb_getnextcabinet)
PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab);
if (result == NULL)
return -1;
- if (!PyString_Check(result)) {
+ if (!PyBytes_Check(result)) {
PyErr_Format(PyExc_TypeError,
"Incorrect return type %s from getnextcabinet",
result->ob_type->tp_name);
Py_DECREF(result);
return FALSE;
}
- strncpy(pccab->szCab, PyString_AsString(result), sizeof(pccab->szCab));
+ strncpy(pccab->szCab, PyBytes_AsString(result), sizeof(pccab->szCab));
return TRUE;
}
return FALSE;
@@ -507,7 +507,7 @@ summary_getproperty(msiobj* si, PyObject *args)
PyErr_SetString(PyExc_NotImplementedError, "FILETIME result");
return NULL;
case VT_LPSTR:
- result = PyString_FromStringAndSize(sval, ssize);
+ result = PyBytes_FromStringAndSize(sval, ssize);
if (sval != sbuf)
free(sval);
return result;
@@ -539,9 +539,9 @@ summary_setproperty(msiobj* si, PyObject *args)
if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data))
return NULL;
- if (PyString_Check(data)) {
+ if (PyBytes_Check(data)) {
status = MsiSummaryInfoSetProperty(si->h, field, VT_LPSTR,
- 0, NULL, PyString_AsString(data));
+ 0, NULL, PyBytes_AsString(data));
} else if (PyInt_Check(data)) {
status = MsiSummaryInfoSetProperty(si->h, field, VT_I4,
PyInt_AsLong(data), NULL, NULL);
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[] = {
diff --git a/PC/_winreg.c b/PC/_winreg.c
index 74d3343..edf2897 100644
--- a/PC/_winreg.c
+++ b/PC/_winreg.c
@@ -424,7 +424,7 @@ PyHKEY_strFunc(PyObject *ob)
PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
char resBuf[160];
wsprintf(resBuf, "<PyHKEY:%p>", pyhkey->hkey);
- return PyString_FromString(resBuf);
+ return PyBytes_FromString(resBuf);
}
static int
@@ -767,11 +767,11 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
return FALSE;
need_decref = 1;
}
- if (!PyString_Check(value))
+ if (!PyBytes_Check(value))
return FALSE;
*retDataSize = 1 + strlen(
- PyString_AS_STRING(
- (PyStringObject *)value));
+ PyBytes_AS_STRING(
+ (PyBytesObject *)value));
}
*retDataBuf = (BYTE *)PyMem_NEW(DWORD, *retDataSize);
if (*retDataBuf==NULL){
@@ -782,8 +782,8 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
strcpy((char *)*retDataBuf, "");
else
strcpy((char *)*retDataBuf,
- PyString_AS_STRING(
- (PyStringObject *)value));
+ PyBytes_AS_STRING(
+ (PyBytesObject *)value));
if (need_decref)
Py_DECREF(value);
break;
@@ -808,7 +808,7 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
PyObject *t;
t = PyList_GET_ITEM(
(PyListObject *)value,j);
- if (PyString_Check(t)) {
+ if (PyBytes_Check(t)) {
obs[j] = t;
Py_INCREF(t);
} else if (PyUnicode_Check(t)) {
@@ -821,8 +821,8 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
} else
goto reg_multi_fail;
size += 1 + strlen(
- PyString_AS_STRING(
- (PyStringObject *)obs[j]));
+ PyBytes_AS_STRING(
+ (PyBytesObject *)obs[j]));
}
*retDataSize = size + 1;
@@ -839,11 +839,11 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
PyObject *t;
t = obs[j];
strcpy(P,
- PyString_AS_STRING(
- (PyStringObject *)t));
+ PyBytes_AS_STRING(
+ (PyBytesObject *)t));
P += 1 + strlen(
- PyString_AS_STRING(
- (PyStringObject *)t));
+ PyBytes_AS_STRING(
+ (PyBytesObject *)t));
Py_DECREF(obs[j]);
}
/* And doubly-terminate the list... */
@@ -1085,7 +1085,7 @@ PyEnumKey(PyObject *self, PyObject *args)
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc, "RegEnumKeyEx");
- retStr = PyString_FromStringAndSize(tmpbuf, len);
+ retStr = PyBytes_FromStringAndSize(tmpbuf, len);
return retStr; /* can be NULL */
}
@@ -1303,17 +1303,17 @@ PyQueryValue(PyObject *self, PyObject *args)
!= ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegQueryValue");
- retStr = PyString_FromStringAndSize(NULL, bufSize);
+ retStr = PyBytes_FromStringAndSize(NULL, bufSize);
if (retStr == NULL)
return NULL;
- retBuf = PyString_AS_STRING(retStr);
+ retBuf = PyBytes_AS_STRING(retStr);
if ((rc = RegQueryValue(hKey, subKey, retBuf, &bufSize))
!= ERROR_SUCCESS) {
Py_DECREF(retStr);
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegQueryValue");
}
- _PyString_Resize(&retStr, strlen(retBuf));
+ _PyBytes_Resize(&retStr, strlen(retBuf));
return retStr;
}
@@ -1414,14 +1414,14 @@ PySetValue(PyObject *self, PyObject *args)
return NULL;
}
/* XXX - need Unicode support */
- str = PyString_AsString(obStrVal);
+ str = PyBytes_AsString(obStrVal);
if (str == NULL)
return NULL;
- len = PyString_Size(obStrVal);
+ len = PyBytes_Size(obStrVal);
if (obSubKey == Py_None)
subKey = NULL;
else {
- subKey = PyString_AsString(obSubKey);
+ subKey = PyBytes_AsString(obSubKey);
if (subKey == NULL)
return NULL;
}
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index e110ed8..757d85e 100755
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -140,7 +140,7 @@ msvcrt_getch(PyObject *self, PyObject *args)
ch = _getch();
Py_END_ALLOW_THREADS
s[0] = ch;
- return PyString_FromStringAndSize(s, 1);
+ return PyBytes_FromStringAndSize(s, 1);
}
static PyObject *
@@ -172,7 +172,7 @@ msvcrt_getche(PyObject *self, PyObject *args)
ch = _getche();
Py_END_ALLOW_THREADS
s[0] = ch;
- return PyString_FromStringAndSize(s, 1);
+ return PyBytes_FromStringAndSize(s, 1);
}
static PyObject *
diff --git a/PC/winsound.c b/PC/winsound.c
index e6ff226..4caadb3 100644
--- a/PC/winsound.c
+++ b/PC/winsound.c
@@ -151,7 +151,7 @@ static struct PyMethodDef sound_methods[] =
static void
add_define(PyObject *dict, const char *key, long value)
{
- PyObject *k=PyString_FromString(key);
+ PyObject *k=PyBytes_FromString(key);
PyObject *v=PyLong_FromLong(value);
if(v&&k)
{