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.
This commit is contained in:
Gregory P. Smith 2008-06-09 04:58:54 +00:00
parent e98839a1f4
commit dd96db63f6
173 changed files with 2275 additions and 2280 deletions

View file

@ -111,7 +111,7 @@ cl_CompressImage(PyObject *self, PyObject *args)
return NULL;
retry:
compressedBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize);
compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
if (compressedBuffer == NULL)
return NULL;
@ -120,7 +120,7 @@ cl_CompressImage(PyObject *self, PyObject *args)
if (clCompressImage(compressionScheme, width, height, originalFormat,
compressionRatio, (void *) frameBuffer,
&compressedBufferSize,
(void *) PyBytes_AsString(compressedBuffer))
(void *) PyString_AsString(compressedBuffer))
== FAILURE || error_handler_called) {
Py_DECREF(compressedBuffer);
if (!error_handler_called)
@ -135,7 +135,7 @@ cl_CompressImage(PyObject *self, PyObject *args)
}
if (compressedBufferSize < frameBufferSize)
_PyBytes_Resize(&compressedBuffer, compressedBufferSize);
_PyString_Resize(&compressedBuffer, compressedBufferSize);
return compressedBuffer;
}
@ -155,14 +155,14 @@ cl_DecompressImage(PyObject *self, PyObject *args)
frameBufferSize = width * height * CL_BytesPerPixel(originalFormat);
frameBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize);
frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
if (frameBuffer == NULL)
return NULL;
error_handler_called = 0;
if (clDecompressImage(compressionScheme, width, height, originalFormat,
compressedBufferSize, compressedBuffer,
(void *) PyBytes_AsString(frameBuffer))
(void *) PyString_AsString(frameBuffer))
== FAILURE || error_handler_called) {
Py_DECREF(frameBuffer);
if (!error_handler_called)
@ -236,14 +236,14 @@ clm_Compress(PyObject *self, PyObject *args)
if (error_handler_called)
return NULL;
data = PyBytes_FromStringAndSize(NULL, size);
data = PyString_FromStringAndSize(NULL, size);
if (data == NULL)
return NULL;
error_handler_called = 0;
if (clCompress(SELF->ob_compressorHdl, numberOfFrames,
(void *) frameBuffer, &compressedBufferSize,
(void *) PyBytes_AsString(data)) == FAILURE ||
(void *) PyString_AsString(data)) == FAILURE ||
error_handler_called) {
Py_DECREF(data);
if (!error_handler_called)
@ -252,7 +252,7 @@ clm_Compress(PyObject *self, PyObject *args)
}
if (compressedBufferSize < size)
if (_PyBytes_Resize(&data, compressedBufferSize))
if (_PyString_Resize(&data, compressedBufferSize))
return NULL;
if (compressedBufferSize > size) {
@ -285,14 +285,14 @@ clm_Decompress(PyObject *self, PyObject *args)
if (error_handler_called)
return NULL;
data = PyBytes_FromStringAndSize(NULL, dataSize);
data = PyString_FromStringAndSize(NULL, dataSize);
if (data == NULL)
return NULL;
error_handler_called = 0;
if (clDecompress(SELF->ob_compressorHdl, numberOfFrames,
compressedDataSize, (void *) compressedData,
(void *) PyBytes_AsString(data)) == FAILURE ||
(void *) PyString_AsString(data)) == FAILURE ||
error_handler_called) {
Py_DECREF(data);
if (!error_handler_called)
@ -514,7 +514,7 @@ clm_QueryParams(PyObject *self)
PyList_SetItem(list, i, Py_None);
} else
PyList_SetItem(list, i,
PyBytes_FromString((char *) PVbuffer[i]));
PyString_FromString((char *) PVbuffer[i]));
}
PyMem_DEL(PVbuffer);
@ -563,7 +563,7 @@ clm_GetName(PyObject *self, PyObject *args)
return NULL;
}
return PyBytes_FromString(name);
return PyString_FromString(name);
}
static PyObject *
@ -775,7 +775,7 @@ cl_QueryAlgorithms(PyObject *self, PyObject *args)
PyList_SetItem(list, i, Py_None);
} else
PyList_SetItem(list, i,
PyBytes_FromString((char *) PVbuffer[i]));
PyString_FromString((char *) PVbuffer[i]));
}
PyMem_DEL(PVbuffer);
@ -818,7 +818,7 @@ cl_GetAlgorithmName(PyObject *self, PyObject *args)
return NULL;
}
return PyBytes_FromString(name);
return PyString_FromString(name);
}
static PyObject *