summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-05-26 13:22:05 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-05-26 13:22:05 (GMT)
commit9c4756ea265b5ebd71c9ae59f3673c7cecb6f060 (patch)
tree642b21e774a9cb2d949e10ce65e7d10326c70138 /Modules
parent96d02f3c1e145821cd5ce8817d4263e7d8d57e4a (diff)
downloadcpython-9c4756ea265b5ebd71c9ae59f3673c7cecb6f060.zip
cpython-9c4756ea265b5ebd71c9ae59f3673c7cecb6f060.tar.gz
cpython-9c4756ea265b5ebd71c9ae59f3673c7cecb6f060.tar.bz2
Renamed PyBytes to PyByteArray
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bsddb.c6
-rw-r--r--Modules/_ctypes/_ctypes.c2
-rw-r--r--Modules/_ctypes/cfield.c4
-rw-r--r--Modules/_dbmmodule.c10
-rw-r--r--Modules/_sqlite/cursor.c6
-rw-r--r--Modules/_sqlite/module.c2
-rw-r--r--Modules/_sqlite/statement.c2
-rw-r--r--Modules/_ssl.c12
-rw-r--r--Modules/_struct.c12
-rw-r--r--Modules/arraymodule.c4
-rw-r--r--Modules/mmapmodule.c10
-rw-r--r--Modules/ossaudiodev.c6
-rw-r--r--Modules/pyexpat.c4
-rw-r--r--Modules/zipimport.c22
-rw-r--r--Modules/zlibmodule.c62
15 files changed, 82 insertions, 82 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index 02973aa..28f2caf 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -1174,14 +1174,14 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData,
else if (PyLong_Check(result)) {
retval = PyLong_AsLong(result);
}
- else if (PyBytes_Check(result) || PyString_Check(result)) {
+ else if (PyByteArray_Check(result) || PyString_Check(result)) {
char* data;
Py_ssize_t size;
CLEAR_DBT(*secKey);
size = Py_SIZE(result);
- if (PyBytes_Check(result))
- data = PyBytes_AS_STRING(result);
+ if (PyByteArray_Check(result))
+ data = PyByteArray_AS_STRING(result);
else
data = PyString_AS_STRING(result);
secKey->flags = DB_DBT_APPMALLOC; /* DB will free */
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 98c609c..1d548dc 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1596,7 +1596,7 @@ c_void_p_from_param(PyObject *type, PyObject *value)
return (PyObject *)parg;
}
/* bytes */
- if (PyBytes_Check(value)) {
+ if (PyByteArray_Check(value)) {
PyCArgObject *parg;
struct fielddesc *fd = getentry("z");
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 4e02563..86f6b53 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1172,8 +1172,8 @@ c_set(void *ptr, PyObject *value, Py_ssize_t size)
*(char *)ptr = PyString_AS_STRING(value)[0];
_RET(value);
}
- if (PyBytes_Check(value) && PyBytes_GET_SIZE(value) == 1) {
- *(char *)ptr = PyBytes_AS_STRING(value)[0];
+ if (PyByteArray_Check(value) && PyByteArray_GET_SIZE(value) == 1) {
+ *(char *)ptr = PyByteArray_AS_STRING(value)[0];
_RET(value);
}
if (PyLong_Check(value))
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 1a49e24..8484d94 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 PyBytes_FromStringAndSize(drec.dptr, drec.dsize);
+ return PyByteArray_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 = PyBytes_FromStringAndSize(key.dptr, key.dsize);
+ item = PyByteArray_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 PyBytes_FromStringAndSize(val.dptr, val.dsize);
+ return PyByteArray_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 PyBytes_FromStringAndSize(val.dptr, val.dsize);
+ return PyByteArray_FromStringAndSize(val.dptr, val.dsize);
if (defvalue == NULL) {
- defvalue = PyBytes_FromStringAndSize(NULL, 0);
+ defvalue = PyByteArray_FromStringAndSize(NULL, 0);
if (defvalue == NULL)
return NULL;
val.dptr = NULL;
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 10ce2e1..4ab8461 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -352,7 +352,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
}
PyOS_snprintf(buf, sizeof(buf) - 1, "Could not decode to UTF-8 column '%s' with text '%s'",
colname , val_str);
- buf_bytes = PyBytes_FromStringAndSize(buf, strlen(buf));
+ buf_bytes = PyByteArray_FromStringAndSize(buf, strlen(buf));
if (!buf_bytes) {
PyErr_SetString(pysqlite_OperationalError, "Could not decode to UTF-8");
} else {
@@ -368,8 +368,8 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
}
} else if (self->connection->text_factory == (PyObject*)&PyString_Type) {
converted = PyString_FromString(val_str);
- } else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) {
- converted = PyBytes_FromStringAndSize(val_str, strlen(val_str));
+ } else if (self->connection->text_factory == (PyObject*)&PyByteArray_Type) {
+ converted = PyByteArray_FromStringAndSize(val_str, strlen(val_str));
} else {
converted = PyObject_CallFunction(self->connection->text_factory, "y", val_str);
}
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index 2284eaa..1f8c63f 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -137,7 +137,7 @@ static PyObject* module_register_adapter(PyObject* self, PyObject* args, PyObjec
/* a basic type is adapted; there's a performance optimization if that's not the case
* (99 % of all usages) */
if (type == &PyLong_Type || type == &PyFloat_Type
- || type == &PyUnicode_Type || type == &PyBytes_Type) {
+ || type == &PyUnicode_Type || type == &PyByteArray_Type) {
pysqlite_BaseTypeAdapted = 1;
}
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index ebf948b..ddbb85e 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -167,7 +167,7 @@ static int _need_adapt(PyObject* obj)
}
if (PyLong_CheckExact(obj) || PyFloat_CheckExact(obj)
- || PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
+ || PyUnicode_CheckExact(obj) || PyByteArray_CheckExact(obj)) {
return 0;
} else {
return 1;
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 296a425..beb212f 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1263,16 +1263,16 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "|Oi:read", &buf, &count))
return NULL;
if ((buf == NULL) || (buf == Py_None)) {
- if (!(buf = PyBytes_FromStringAndSize((char *) 0, len)))
+ if (!(buf = PyByteArray_FromStringAndSize((char *) 0, len)))
return NULL;
} else if (PyLong_Check(buf)) {
len = PyLong_AS_LONG(buf);
- if (!(buf = PyBytes_FromStringAndSize((char *) 0, len)))
+ if (!(buf = PyByteArray_FromStringAndSize((char *) 0, len)))
return NULL;
} else {
- if (!PyBytes_Check(buf))
+ if (!PyByteArray_Check(buf))
return NULL;
- len = PyBytes_Size(buf);
+ len = PyByteArray_Size(buf);
if ((count > 0) && (count <= len))
len = count;
buf_passed = 1;
@@ -1313,7 +1313,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
do {
err = 0;
PySSL_BEGIN_ALLOW_THREADS
- count = SSL_read(self->ssl, PyBytes_AsString(buf), len);
+ count = SSL_read(self->ssl, PyByteArray_AsString(buf), len);
err = SSL_get_error(self->ssl, count);
PySSL_END_ALLOW_THREADS
if(PyErr_CheckSignals()) {
@@ -1357,7 +1357,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
done:
if (!buf_passed) {
PyObject *res = PyString_FromStringAndSize(
- PyBytes_AS_STRING(buf), count);
+ PyByteArray_AS_STRING(buf), count);
Py_DECREF(buf);
return res;
} else {
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 13ffee7..c162e6d 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1646,7 +1646,7 @@ s_pack_internal(PyStructObject *soself, PyObject *args, int offset, char* buf)
return -1;
}
isstring = PyString_Check(v);
- if (!isstring && !PyBytes_Check(v)) {
+ if (!isstring && !PyByteArray_Check(v)) {
PyErr_SetString(StructError,
"argument for 's' must be a string");
return -1;
@@ -1656,8 +1656,8 @@ s_pack_internal(PyStructObject *soself, PyObject *args, int offset, char* buf)
p = PyString_AS_STRING(v);
}
else {
- n = PyBytes_GET_SIZE(v);
- p = PyBytes_AS_STRING(v);
+ n = PyByteArray_GET_SIZE(v);
+ p = PyByteArray_AS_STRING(v);
}
if (n > code->size)
n = code->size;
@@ -1672,7 +1672,7 @@ s_pack_internal(PyStructObject *soself, PyObject *args, int offset, char* buf)
return -1;
}
isstring = PyString_Check(v);
- if (!isstring && !PyBytes_Check(v)) {
+ if (!isstring && !PyByteArray_Check(v)) {
PyErr_SetString(StructError,
"argument for 'p' must be a string");
return -1;
@@ -1682,8 +1682,8 @@ s_pack_internal(PyStructObject *soself, PyObject *args, int offset, char* buf)
p = PyString_AS_STRING(v);
}
else {
- n = PyBytes_GET_SIZE(v);
- p = PyBytes_AS_STRING(v);
+ n = PyByteArray_GET_SIZE(v);
+ p = PyByteArray_AS_STRING(v);
}
if (n > (code->size - 1))
n = code->size - 1;
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 240a372..a851212 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1855,7 +1855,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
if (!(initial == NULL || PyList_Check(initial)
- || PyBytes_Check(initial)
+ || PyByteArray_Check(initial)
|| PyString_Check(initial)
|| PyTuple_Check(initial)
|| ((c=='u') && PyUnicode_Check(initial)))) {
@@ -1901,7 +1901,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(v);
}
}
- else if (initial != NULL && (PyBytes_Check(initial) ||
+ else if (initial != NULL && (PyByteArray_Check(initial) ||
PyString_Check(initial))) {
PyObject *t_initial, *v;
t_initial = PyTuple_Pack(1, initial);
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 469c531..a6cd50b 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 = PyBytes_FromStringAndSize(start, (eol - start));
+ result = PyByteArray_FromStringAndSize(start, (eol - start));
self->pos += (eol - start);
return result;
}
@@ -248,7 +248,7 @@ mmap_read_method(mmap_object *self,
if ((self->pos + num_bytes) > self->size) {
num_bytes -= (self->pos+num_bytes) - self->size;
}
- result = PyBytes_FromStringAndSize(self->data+self->pos, num_bytes);
+ result = PyByteArray_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 PyBytes_FromStringAndSize(self->data + i, 1);
+ return PyByteArray_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 (! (PyBytes_Check(v) && PyBytes_Size(v)==1) ) {
+ if (! (PyByteArray_Check(v) && PyByteArray_Size(v)==1) ) {
PyErr_SetString(PyExc_IndexError,
"mmap assignment must be length-1 bytes()");
return -1;
}
if (!is_writable(self))
return -1;
- buf = PyBytes_AsString(v);
+ buf = PyByteArray_AsString(v);
self->data[i] = buf[0];
return 0;
}
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 2bd79d5..b976873 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 = PyBytes_FromStringAndSize(NULL, size);
+ rv = PyByteArray_FromStringAndSize(NULL, size);
if (rv == NULL)
return NULL;
- cp = PyBytes_AS_STRING(rv);
+ cp = PyByteArray_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;
- PyBytes_Resize(rv, count);
+ PyByteArray_Resize(rv, count);
return rv;
}
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 0053201..852d093 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -866,8 +866,8 @@ readinst(char *buf, int buf_size, PyObject *meth)
if (PyString_Check(str))
ptr = PyString_AS_STRING(str);
- else if (PyBytes_Check(str))
- ptr = PyBytes_AS_STRING(str);
+ else if (PyByteArray_Check(str))
+ ptr = PyByteArray_AS_STRING(str);
else {
PyErr_Format(PyExc_TypeError,
"read() did not return a bytes object (type=%.400s)",
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 9503643..4ad93d5 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -467,7 +467,7 @@ zipimporter_get_source(PyObject *obj, PyObject *args)
toc_entry = PyDict_GetItemString(self->files, path);
if (toc_entry != NULL) {
PyObject *bytes = get_data(PyUnicode_AsString(self->archive), toc_entry);
- PyObject *res = PyUnicode_FromString(PyBytes_AsString(bytes));
+ PyObject *res = PyUnicode_FromString(PyByteArray_AsString(bytes));
Py_XDECREF(bytes);
return res;
}
@@ -836,13 +836,13 @@ get_data(char *archive, PyObject *toc_entry)
bytes_size = compress == 0 ? data_size : data_size + 1;
if (bytes_size == 0)
bytes_size++;
- raw_data = PyBytes_FromStringAndSize((char *)NULL, bytes_size);
+ raw_data = PyByteArray_FromStringAndSize((char *)NULL, bytes_size);
if (raw_data == NULL) {
fclose(fp);
return NULL;
}
- buf = PyBytes_AsString(raw_data);
+ buf = PyByteArray_AsString(raw_data);
err = fseek(fp, file_offset, 0);
if (err == 0)
@@ -862,7 +862,7 @@ get_data(char *archive, PyObject *toc_entry)
buf[data_size] = '\0';
if (compress == 0) { /* data is not compressed */
- data = PyBytes_FromStringAndSize(buf, data_size);
+ data = PyByteArray_FromStringAndSize(buf, data_size);
Py_DECREF(raw_data);
return data;
}
@@ -903,8 +903,8 @@ static PyObject *
unmarshal_code(char *pathname, PyObject *data, time_t mtime)
{
PyObject *code;
- char *buf = PyBytes_AsString(data);
- Py_ssize_t size = PyBytes_Size(data);
+ char *buf = PyByteArray_AsString(data);
+ Py_ssize_t size = PyByteArray_Size(data);
if (size <= 9) {
PyErr_SetString(ZipImportError,
@@ -949,16 +949,16 @@ unmarshal_code(char *pathname, PyObject *data, time_t mtime)
static PyObject *
normalize_line_endings(PyObject *source)
{
- char *buf, *q, *p = PyBytes_AsString(source);
+ char *buf, *q, *p = PyByteArray_AsString(source);
PyObject *fixed_source;
int len = 0;
if (!p) {
- return PyBytes_FromStringAndSize("\n\0", 2);
+ return PyByteArray_FromStringAndSize("\n\0", 2);
}
/* one char extra for trailing \n and one for terminating \0 */
- buf = (char *)PyMem_Malloc(PyBytes_Size(source) + 2);
+ buf = (char *)PyMem_Malloc(PyByteArray_Size(source) + 2);
if (buf == NULL) {
PyErr_SetString(PyExc_MemoryError,
"zipimport: no memory to allocate "
@@ -978,7 +978,7 @@ normalize_line_endings(PyObject *source)
}
*q++ = '\n'; /* add trailing \n */
*q = '\0';
- fixed_source = PyBytes_FromStringAndSize(buf, len + 2);
+ fixed_source = PyByteArray_FromStringAndSize(buf, len + 2);
PyMem_Free(buf);
return fixed_source;
}
@@ -994,7 +994,7 @@ compile_source(char *pathname, PyObject *source)
if (fixed_source == NULL)
return NULL;
- code = Py_CompileString(PyBytes_AsString(fixed_source), pathname,
+ code = Py_CompileString(PyByteArray_AsString(fixed_source), pathname,
Py_file_input);
Py_DECREF(fixed_source);
return code;
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 4d941af..0be9d6f 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -96,12 +96,12 @@ newcompobject(PyTypeObject *type)
if (self == NULL)
return NULL;
self->is_initialised = 0;
- self->unused_data = PyBytes_FromStringAndSize("", 0);
+ self->unused_data = PyByteArray_FromStringAndSize("", 0);
if (self->unused_data == NULL) {
Py_DECREF(self);
return NULL;
}
- self->unconsumed_tail = PyBytes_FromStringAndSize("", 0);
+ self->unconsumed_tail = PyByteArray_FromStringAndSize("", 0);
if (self->unconsumed_tail == NULL) {
Py_DECREF(self);
return NULL;
@@ -174,7 +174,7 @@ PyZlib_compress(PyObject *self, PyObject *args)
err=deflateEnd(&zst);
if (err == Z_OK)
- ReturnVal = PyBytes_FromStringAndSize((char *)output,
+ ReturnVal = PyByteArray_FromStringAndSize((char *)output,
zst.total_out);
else
zlib_error(zst, err, "while finishing compression");
@@ -211,12 +211,12 @@ PyZlib_decompress(PyObject *self, PyObject *args)
zst.avail_in = length;
zst.avail_out = r_strlen;
- if (!(result_str = PyBytes_FromStringAndSize(NULL, r_strlen)))
+ if (!(result_str = PyByteArray_FromStringAndSize(NULL, r_strlen)))
return NULL;
zst.zalloc = (alloc_func)NULL;
zst.zfree = (free_func)Z_NULL;
- zst.next_out = (Byte *)PyBytes_AS_STRING(result_str);
+ zst.next_out = (Byte *)PyByteArray_AS_STRING(result_str);
zst.next_in = (Byte *)input;
err = inflateInit2(&zst, wsize);
@@ -256,12 +256,12 @@ PyZlib_decompress(PyObject *self, PyObject *args)
/* fall through */
case(Z_OK):
/* need more memory */
- if (PyBytes_Resize(result_str, r_strlen << 1) < 0) {
+ if (PyByteArray_Resize(result_str, r_strlen << 1) < 0) {
inflateEnd(&zst);
goto error;
}
zst.next_out =
- (unsigned char *)PyBytes_AS_STRING(result_str) + r_strlen;
+ (unsigned char *)PyByteArray_AS_STRING(result_str) + r_strlen;
zst.avail_out = r_strlen;
r_strlen = r_strlen << 1;
break;
@@ -278,7 +278,7 @@ PyZlib_decompress(PyObject *self, PyObject *args)
goto error;
}
- if (PyBytes_Resize(result_str, zst.total_out) < 0)
+ if (PyByteArray_Resize(result_str, zst.total_out) < 0)
goto error;
return result_str;
@@ -402,7 +402,7 @@ PyZlib_objcompress(compobject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen))
return NULL;
- if (!(RetVal = PyBytes_FromStringAndSize(NULL, length)))
+ if (!(RetVal = PyByteArray_FromStringAndSize(NULL, length)))
return NULL;
ENTER_ZLIB
@@ -411,7 +411,7 @@ PyZlib_objcompress(compobject *self, PyObject *args)
self->zst.avail_in = inplen;
self->zst.next_in = input;
self->zst.avail_out = length;
- self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal);
+ self->zst.next_out = (unsigned char *)PyByteArray_AS_STRING(RetVal);
Py_BEGIN_ALLOW_THREADS
err = deflate(&(self->zst), Z_NO_FLUSH);
@@ -420,13 +420,13 @@ PyZlib_objcompress(compobject *self, PyObject *args)
/* while Z_OK and the output buffer is full, there might be more output,
so extend the output buffer and try again */
while (err == Z_OK && self->zst.avail_out == 0) {
- if (PyBytes_Resize(RetVal, length << 1) < 0) {
+ if (PyByteArray_Resize(RetVal, length << 1) < 0) {
Py_DECREF(RetVal);
RetVal = NULL;
goto error;
}
self->zst.next_out =
- (unsigned char *)PyBytes_AS_STRING(RetVal) + length;
+ (unsigned char *)PyByteArray_AS_STRING(RetVal) + length;
self->zst.avail_out = length;
length = length << 1;
@@ -445,7 +445,7 @@ PyZlib_objcompress(compobject *self, PyObject *args)
RetVal = NULL;
goto error;
}
- if (PyBytes_Resize(RetVal, self->zst.total_out - start_total_out) < 0) {
+ if (PyByteArray_Resize(RetVal, self->zst.total_out - start_total_out) < 0) {
Py_DECREF(RetVal);
RetVal = NULL;
}
@@ -487,7 +487,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
/* limit amount of data allocated to max_length */
if (max_length && length > max_length)
length = max_length;
- if (!(RetVal = PyBytes_FromStringAndSize(NULL, length)))
+ if (!(RetVal = PyByteArray_FromStringAndSize(NULL, length)))
return NULL;
ENTER_ZLIB
@@ -496,7 +496,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
self->zst.avail_in = inplen;
self->zst.next_in = input;
self->zst.avail_out = length;
- self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal);
+ self->zst.next_out = (unsigned char *)PyByteArray_AS_STRING(RetVal);
Py_BEGIN_ALLOW_THREADS
err = inflate(&(self->zst), Z_SYNC_FLUSH);
@@ -518,13 +518,13 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
if (max_length && length > max_length)
length = max_length;
- if (PyBytes_Resize(RetVal, length) < 0) {
+ if (PyByteArray_Resize(RetVal, length) < 0) {
Py_DECREF(RetVal);
RetVal = NULL;
goto error;
}
self->zst.next_out =
- (unsigned char *)PyBytes_AS_STRING(RetVal) + old_length;
+ (unsigned char *)PyByteArray_AS_STRING(RetVal) + old_length;
self->zst.avail_out = length - old_length;
Py_BEGIN_ALLOW_THREADS
@@ -536,7 +536,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
of specified size. Return the unconsumed tail in an attribute.*/
if(max_length) {
Py_DECREF(self->unconsumed_tail);
- self->unconsumed_tail = PyBytes_FromStringAndSize((char *)self->zst.next_in,
+ self->unconsumed_tail = PyByteArray_FromStringAndSize((char *)self->zst.next_in,
self->zst.avail_in);
if(!self->unconsumed_tail) {
Py_DECREF(RetVal);
@@ -553,7 +553,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
*/
if (err == Z_STREAM_END) {
Py_XDECREF(self->unused_data); /* Free original empty string */
- self->unused_data = PyBytes_FromStringAndSize(
+ self->unused_data = PyByteArray_FromStringAndSize(
(char *)self->zst.next_in, self->zst.avail_in);
if (self->unused_data == NULL) {
Py_DECREF(RetVal);
@@ -570,7 +570,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
goto error;
}
- if (PyBytes_Resize(RetVal, self->zst.total_out - start_total_out) < 0) {
+ if (PyByteArray_Resize(RetVal, self->zst.total_out - start_total_out) < 0) {
Py_DECREF(RetVal);
RetVal = NULL;
}
@@ -603,10 +603,10 @@ PyZlib_flush(compobject *self, PyObject *args)
/* Flushing with Z_NO_FLUSH is a no-op, so there's no point in
doing any work at all; just return an empty string. */
if (flushmode == Z_NO_FLUSH) {
- return PyBytes_FromStringAndSize(NULL, 0);
+ return PyByteArray_FromStringAndSize(NULL, 0);
}
- if (!(RetVal = PyBytes_FromStringAndSize(NULL, length)))
+ if (!(RetVal = PyByteArray_FromStringAndSize(NULL, length)))
return NULL;
ENTER_ZLIB
@@ -614,7 +614,7 @@ PyZlib_flush(compobject *self, PyObject *args)
start_total_out = self->zst.total_out;
self->zst.avail_in = 0;
self->zst.avail_out = length;
- self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal);
+ self->zst.next_out = (unsigned char *)PyByteArray_AS_STRING(RetVal);
Py_BEGIN_ALLOW_THREADS
err = deflate(&(self->zst), flushmode);
@@ -623,13 +623,13 @@ PyZlib_flush(compobject *self, PyObject *args)
/* while Z_OK and the output buffer is full, there might be more output,
so extend the output buffer and try again */
while (err == Z_OK && self->zst.avail_out == 0) {
- if (PyBytes_Resize(RetVal, length << 1) < 0) {
+ if (PyByteArray_Resize(RetVal, length << 1) < 0) {
Py_DECREF(RetVal);
RetVal = NULL;
goto error;
}
self->zst.next_out =
- (unsigned char *)PyBytes_AS_STRING(RetVal) + length;
+ (unsigned char *)PyByteArray_AS_STRING(RetVal) + length;
self->zst.avail_out = length;
length = length << 1;
@@ -663,7 +663,7 @@ PyZlib_flush(compobject *self, PyObject *args)
goto error;
}
- if (PyBytes_Resize(RetVal, self->zst.total_out - start_total_out) < 0) {
+ if (PyByteArray_Resize(RetVal, self->zst.total_out - start_total_out) < 0) {
Py_DECREF(RetVal);
RetVal = NULL;
}
@@ -798,7 +798,7 @@ PyZlib_unflush(compobject *self, PyObject *args)
PyErr_SetString(PyExc_ValueError, "length must be greater than zero");
return NULL;
}
- if (!(retval = PyBytes_FromStringAndSize(NULL, length)))
+ if (!(retval = PyByteArray_FromStringAndSize(NULL, length)))
return NULL;
@@ -806,7 +806,7 @@ PyZlib_unflush(compobject *self, PyObject *args)
start_total_out = self->zst.total_out;
self->zst.avail_out = length;
- self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval);
+ self->zst.next_out = (Byte *)PyByteArray_AS_STRING(retval);
Py_BEGIN_ALLOW_THREADS
err = inflate(&(self->zst), Z_FINISH);
@@ -815,12 +815,12 @@ PyZlib_unflush(compobject *self, PyObject *args)
/* while Z_OK and the output buffer is full, there might be more output,
so extend the output buffer and try again */
while ((err == Z_OK || err == Z_BUF_ERROR) && self->zst.avail_out == 0) {
- if (PyBytes_Resize(retval, length << 1) < 0) {
+ if (PyByteArray_Resize(retval, length << 1) < 0) {
Py_DECREF(retval);
retval = NULL;
goto error;
}
- self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval) + length;
+ self->zst.next_out = (Byte *)PyByteArray_AS_STRING(retval) + length;
self->zst.avail_out = length;
length = length << 1;
@@ -842,7 +842,7 @@ PyZlib_unflush(compobject *self, PyObject *args)
goto error;
}
}
- if (PyBytes_Resize(retval, self->zst.total_out - start_total_out) < 0) {
+ if (PyByteArray_Resize(retval, self->zst.total_out - start_total_out) < 0) {
Py_DECREF(retval);
retval = NULL;
}