summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-09-06 21:34:51 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-09-06 21:34:51 (GMT)
commit0a608fdaac5b4422b9ade6ec7b44182902f2f9ce (patch)
tree80f50c009d21accfd42b8a736ce9761370169995 /Modules
parent7e958d1ceb0b92fa7bace7040ce042474d3ea510 (diff)
downloadcpython-0a608fdaac5b4422b9ade6ec7b44182902f2f9ce.zip
cpython-0a608fdaac5b4422b9ade6ec7b44182902f2f9ce.tar.gz
cpython-0a608fdaac5b4422b9ade6ec7b44182902f2f9ce.tar.bz2
fixes deferred/release blocker issue #3797: Fixed the dbm, marshal, mmap,
ossaudiodev, & winreg modules to return bytes objects instead of bytearray objects.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_dbmmodule.c10
-rw-r--r--Modules/mmapmodule.c10
-rw-r--r--Modules/ossaudiodev.c6
3 files changed, 13 insertions, 13 deletions
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 78eba36..d43acdc 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -111,7 +111,7 @@ dbm_subscript(dbmobject *dp, register PyObject *key)
PyErr_SetString(DbmError, "");
return NULL;
}
- return PyByteArray_FromStringAndSize(drec.dptr, drec.dsize);
+ return PyBytes_FromStringAndSize(drec.dptr, drec.dsize);
}
static int
@@ -188,7 +188,7 @@ dbm_keys(register dbmobject *dp, PyObject *unused)
return NULL;
for (key = dbm_firstkey(dp->di_dbm); key.dptr;
key = dbm_nextkey(dp->di_dbm)) {
- item = PyByteArray_FromStringAndSize(key.dptr, key.dsize);
+ item = PyBytes_FromStringAndSize(key.dptr, key.dsize);
if (item == NULL) {
Py_DECREF(v);
return NULL;
@@ -260,7 +260,7 @@ dbm_get(register dbmobject *dp, PyObject *args)
check_dbmobject_open(dp);
val = dbm_fetch(dp->di_dbm, key);
if (val.dptr != NULL)
- return PyByteArray_FromStringAndSize(val.dptr, val.dsize);
+ return PyBytes_FromStringAndSize(val.dptr, val.dsize);
else {
Py_INCREF(defvalue);
return defvalue;
@@ -283,9 +283,9 @@ dbm_setdefault(register dbmobject *dp, PyObject *args)
check_dbmobject_open(dp);
val = dbm_fetch(dp->di_dbm, key);
if (val.dptr != NULL)
- return PyByteArray_FromStringAndSize(val.dptr, val.dsize);
+ return PyBytes_FromStringAndSize(val.dptr, val.dsize);
if (defvalue == NULL) {
- defvalue = PyByteArray_FromStringAndSize(NULL, 0);
+ defvalue = PyBytes_FromStringAndSize(NULL, 0);
if (defvalue == NULL)
return NULL;
val.dptr = NULL;
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 9adef9b..6a2ebfd 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -228,7 +228,7 @@ mmap_read_line_method(mmap_object *self,
else
++eol; /* we're interested in the position after the
newline. */
- result = PyByteArray_FromStringAndSize(start, (eol - start));
+ result = PyBytes_FromStringAndSize(start, (eol - start));
self->pos += (eol - start);
return result;
}
@@ -248,7 +248,7 @@ mmap_read_method(mmap_object *self,
if (num_bytes > self->size - self->pos) {
num_bytes -= (self->pos+num_bytes) - self->size;
}
- result = PyByteArray_FromStringAndSize(self->data+self->pos, num_bytes);
+ result = PyBytes_FromStringAndSize(self->data+self->pos, num_bytes);
self->pos += num_bytes;
return result;
}
@@ -679,7 +679,7 @@ mmap_item(mmap_object *self, Py_ssize_t i)
PyErr_SetString(PyExc_IndexError, "mmap index out of range");
return NULL;
}
- return PyByteArray_FromStringAndSize(self->data + i, 1);
+ return PyBytes_FromStringAndSize(self->data + i, 1);
}
static PyObject *
@@ -769,14 +769,14 @@ mmap_ass_item(mmap_object *self, Py_ssize_t i, PyObject *v)
"mmap object doesn't support item deletion");
return -1;
}
- if (! (PyByteArray_Check(v) && PyByteArray_Size(v)==1) ) {
+ if (! (PyBytes_Check(v) && PyBytes_Size(v)==1) ) {
PyErr_SetString(PyExc_IndexError,
"mmap assignment must be length-1 bytes()");
return -1;
}
if (!is_writable(self))
return -1;
- buf = PyByteArray_AsString(v);
+ buf = PyBytes_AsString(v);
self->data[i] = buf[0];
return 0;
}
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 5828c3f..677f9ac 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -366,10 +366,10 @@ oss_read(oss_audio_t *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:read", &size))
return NULL;
- rv = PyByteArray_FromStringAndSize(NULL, size);
+ rv = PyBytes_FromStringAndSize(NULL, size);
if (rv == NULL)
return NULL;
- cp = PyByteArray_AS_STRING(rv);
+ cp = PyBytes_AS_STRING(rv);
Py_BEGIN_ALLOW_THREADS
count = read(self->fd, cp, size);
@@ -381,7 +381,7 @@ oss_read(oss_audio_t *self, PyObject *args)
return NULL;
}
self->icount += count;
- PyByteArray_Resize(rv, count);
+ _PyBytes_Resize(&rv, count);
return rv;
}