diff Modules/cdmodule.c @ 47527:52294af4b663 legacy-trunk

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.
author Gregory P. Smith <greg@mad-scientist.com>
date Mon, 09 Jun 2008 04:58:54 +0000
parents 4fe192d48960
children fd25030223b0
line wrap: on
line diff
--- a/Modules/cdmodule.c	Mon Jun 09 01:28:30 2008 +0000
+++ b/Modules/cdmodule.c	Mon Jun 09 04:58:54 2008 +0000
@@ -239,19 +239,19 @@
 	if (!PyArg_ParseTuple(args, "i:readda", &numframes))
 		return NULL;
 
-	result = PyBytes_FromStringAndSize(NULL, numframes * sizeof(CDFRAME));
+	result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME));
 	if (result == NULL)
 		return NULL;
 
 	n = CDreadda(self->ob_cdplayer,
-		       (CDFRAME *) PyBytes_AsString(result), numframes);
+		       (CDFRAME *) PyString_AsString(result), numframes);
 	if (n == -1) {
 		Py_DECREF(result);
 		PyErr_SetFromErrno(CdError);
 		return NULL;
 	}
 	if (n < numframes)
-		_PyBytes_Resize(&result, n * sizeof(CDFRAME));
+		_PyString_Resize(&result, n * sizeof(CDFRAME));
 
 	return result;
 }
@@ -468,7 +468,7 @@
 	PyTuple_SetItem(args, 1, PyInt_FromLong((long) type));
 	switch (type) {
 	case cd_audio:
-		v = PyBytes_FromStringAndSize(data, CDDA_DATASIZE);
+		v = PyString_FromStringAndSize(data, CDDA_DATASIZE);
 		break;
 	case cd_pnum:
 	case cd_index:
@@ -484,15 +484,15 @@
 #undef ptr
 		break;
 	case cd_catalog:
-		v = PyBytes_FromStringAndSize(NULL, 13);
-		p = PyBytes_AsString(v);
+		v = PyString_FromStringAndSize(NULL, 13);
+		p = PyString_AsString(v);
 		for (i = 0; i < 13; i++)
 			*p++ = ((char *) data)[i] + '0';
 		break;
 	case cd_ident:
 #define ptr ((struct cdident *) data)
-		v = PyBytes_FromStringAndSize(NULL, 12);
-		p = PyBytes_AsString(v);
+		v = PyString_FromStringAndSize(NULL, 12);
+		p = PyString_AsString(v);
 		CDsbtoa(p, ptr->country, 2);
 		p += 2;
 		CDsbtoa(p, ptr->owner, 3);