summaryrefslogtreecommitdiffstats
path: root/Modules/glmodule.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
commitdd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch)
treeb2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Modules/glmodule.c
parente98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff)
downloadcpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.zip
cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz
cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.bz2
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.
Diffstat (limited to 'Modules/glmodule.c')
-rw-r--r--Modules/glmodule.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Modules/glmodule.c b/Modules/glmodule.c
index 301a593..01db9fc 100644
--- a/Modules/glmodule.c
+++ b/Modules/glmodule.c
@@ -593,7 +593,7 @@ gl_lrectwrite(PyObject *self, PyObject *args)
#if 0
/* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */
pixcount = (long)(x2+1-x1) * (long)(y2+1-y1);
- if (!PyBytes_Check(s) || PyBytes_Size(s) != pixcount*sizeof(long)) {
+ if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) {
PyErr_SetString(PyExc_RuntimeError,
"string arg to lrectwrite has wrong size");
return NULL;
@@ -623,10 +623,10 @@ gl_lrectread(PyObject *self, PyObject *args)
if (!PyArg_GetShort(args, 4, 3, &y2))
return NULL;
pixcount = (long)(x2+1-x1) * (long)(y2+1-y1);
- parray = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
+ parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
if (parray == NULL)
return NULL; /* No memory */
- lrectread(x1, y1, x2, y2, (unsigned long *) PyBytes_AsString(parray));
+ lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray));
return parray;
}
@@ -642,10 +642,10 @@ gl_readdisplay(PyObject *self, PyObject *args)
if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) )
return 0;
size = (long)(x2+1-x1) * (long)(y2+1-y1);
- rv = PyBytes_FromStringAndSize((char *)NULL, size*sizeof(long));
+ rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long));
if ( rv == NULL )
return NULL;
- parray = (unsigned long *)PyBytes_AsString(rv);
+ parray = (unsigned long *)PyString_AsString(rv);
size_ret = readdisplay(x1, y1, x2, y2, parray, hints);
if ( size_ret != size ) {
printf("gl_readdisplay: got %ld pixels, expected %ld\n",
@@ -700,16 +700,16 @@ gl_packrect(PyObject *self, PyObject *args)
pixcount = width*height;
packedcount = ((width+packfactor-1)/packfactor) *
((height+packfactor-1)/packfactor);
- if (PyBytes_Size(unpacked) != pixcount*sizeof(long)) {
+ if (PyString_Size(unpacked) != pixcount*sizeof(long)) {
PyErr_SetString(PyExc_RuntimeError,
"string arg to packrect has wrong size");
return NULL;
}
- packed = PyBytes_FromStringAndSize((char *)NULL, packedcount);
+ packed = PyString_FromStringAndSize((char *)NULL, packedcount);
if (packed == NULL)
return NULL;
- parray = (unsigned long *) PyBytes_AsString(unpacked);
- p = (unsigned char *) PyBytes_AsString(packed);
+ parray = (unsigned long *) PyString_AsString(unpacked);
+ p = (unsigned char *) PyString_AsString(packed);
for (y = 0; y < height; y += packfactor, parray += packfactor*width) {
for (x = 0; x < width; x += packfactor) {
pixel = parray[x];
@@ -758,16 +758,16 @@ gl_unpackrect(PyObject *self, PyObject *args)
pixcount = width*height;
packedcount = ((width+packfactor-1)/packfactor) *
((height+packfactor-1)/packfactor);
- if (PyBytes_Size(packed) != packedcount) {
+ if (PyString_Size(packed) != packedcount) {
PyErr_SetString(PyExc_RuntimeError,
"string arg to unpackrect has wrong size");
return NULL;
}
- unpacked = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
+ unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
if (unpacked == NULL)
return NULL;
- parray = (unsigned long *) PyBytes_AsString(unpacked);
- p = (unsigned char *) PyBytes_AsString(packed);
+ parray = (unsigned long *) PyString_AsString(unpacked);
+ p = (unsigned char *) PyString_AsString(packed);
if (packfactor == 1 && width*height > 0) {
/* Just expand bytes to longs */
register int x = width * height;
@@ -799,7 +799,7 @@ gl_gversion(PyObject *self, PyObject *args)
{
char buf[20];
gversion(buf);
- return PyBytes_FromString(buf);
+ return PyString_FromString(buf);
}