This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 75f6c15..ebf101a 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -366,10 +366,10 @@
if (!PyArg_ParseTuple(args, "i:read", &size))
return NULL;
- rv = PyBytes_FromStringAndSize(NULL, size);
+ rv = PyString_FromStringAndSize(NULL, size);
if (rv == NULL)
return NULL;
- cp = PyBytes_AS_STRING(rv);
+ cp = PyString_AS_STRING(rv);
Py_BEGIN_ALLOW_THREADS
count = read(self->fd, cp, size);
@@ -381,7 +381,7 @@
return NULL;
}
self->icount += count;
- _PyBytes_Resize(&rv, count);
+ _PyString_Resize(&rv, count);
return rv;
}
@@ -811,20 +811,20 @@
Py_INCREF(rval);
}
else if (strcmp(name, "name") == 0) {
- rval = PyBytes_FromString(self->devicename);
+ rval = PyString_FromString(self->devicename);
}
else if (strcmp(name, "mode") == 0) {
/* No need for a "default" in this switch: from newossobject(),
self->mode can only be one of these three values. */
switch(self->mode) {
case O_RDONLY:
- rval = PyBytes_FromString("r");
+ rval = PyString_FromString("r");
break;
case O_RDWR:
- rval = PyBytes_FromString("rw");
+ rval = PyString_FromString("rw");
break;
case O_WRONLY:
- rval = PyBytes_FromString("w");
+ rval = PyString_FromString("w");
break;
}
}
@@ -913,12 +913,12 @@
if (labels == NULL || names == NULL)
goto error2;
for (i = 0; i < num_controls; i++) {
- s = PyBytes_FromString(control_labels[i]);
+ s = PyString_FromString(control_labels[i]);
if (s == NULL)
goto error2;
PyList_SET_ITEM(labels, i, s);
- s = PyBytes_FromString(control_names[i]);
+ s = PyString_FromString(control_names[i]);
if (s == NULL)
goto error2;
PyList_SET_ITEM(names, i, s);