Renamed PyBytes to PyByteArray

This commit is contained in:
Christian Heimes 2008-05-26 13:22:05 +00:00
parent 96d02f3c1e
commit 9c4756ea26
31 changed files with 397 additions and 397 deletions

View file

@ -1377,11 +1377,11 @@ builtin_ord(PyObject *self, PyObject* obj)
}
#endif
}
else if (PyBytes_Check(obj)) {
else if (PyByteArray_Check(obj)) {
/* XXX Hopefully this is temporary */
size = PyBytes_GET_SIZE(obj);
size = PyByteArray_GET_SIZE(obj);
if (size == 1) {
ord = (long)((unsigned char)*PyBytes_AS_STRING(obj));
ord = (long)((unsigned char)*PyByteArray_AS_STRING(obj));
return PyLong_FromLong(ord);
}
}
@ -1823,7 +1823,7 @@ builtin_sum(PyObject *self, PyObject *args)
Py_DECREF(iter);
return NULL;
}
if (PyBytes_Check(result)) {
if (PyByteArray_Check(result)) {
PyErr_SetString(PyExc_TypeError,
"sum() can't sum bytes [use b''.join(seq) instead]");
Py_DECREF(iter);
@ -2266,7 +2266,7 @@ _PyBuiltin_Init(void)
SETBUILTIN("True", Py_True);
SETBUILTIN("bool", &PyBool_Type);
SETBUILTIN("memoryview", &PyMemoryView_Type);
SETBUILTIN("bytearray", &PyBytes_Type);
SETBUILTIN("bytearray", &PyByteArray_Type);
SETBUILTIN("bytes", &PyString_Type);
SETBUILTIN("classmethod", &PyClassMethod_Type);
#ifndef WITHOUT_COMPLEX

View file

@ -345,7 +345,7 @@ PyObject *PyCodec_Encode(PyObject *object,
goto onError;
}
v = PyTuple_GET_ITEM(result, 0);
if (PyBytes_Check(v)) {
if (PyByteArray_Check(v)) {
char msg[100];
PyOS_snprintf(msg, sizeof(msg),
"encoder %s returned buffer instead of bytes",
@ -354,7 +354,7 @@ PyObject *PyCodec_Encode(PyObject *object,
v = NULL;
goto onError;
}
v = PyString_FromStringAndSize(PyBytes_AS_STRING(v), Py_SIZE(v));
v = PyString_FromStringAndSize(PyByteArray_AS_STRING(v), Py_SIZE(v));
}
else if (PyString_Check(v))
Py_INCREF(v);

View file

@ -971,7 +971,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
/* Encode object */
if (!recode_strings &&
(PyString_Check(arg) || PyBytes_Check(arg))) {
(PyString_Check(arg) || PyByteArray_Check(arg))) {
s = arg;
Py_INCREF(s);
if (PyObject_AsCharBuffer(s, &ptr, &size) < 0)
@ -1123,9 +1123,9 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
break;
}
case 'Y': { /* PyBytes object */
case 'Y': { /* PyByteArray object */
PyObject **p = va_arg(*p_va, PyObject **);
if (PyBytes_Check(arg))
if (PyByteArray_Check(arg))
*p = arg;
else
return converterr("buffer", arg, msgbuf, bufsize);

View file

@ -1095,7 +1095,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
}
if (wf.str != NULL) {
/* XXX Quick hack -- need to do this differently */
res = PyBytes_FromObject(wf.str);
res = PyByteArray_FromObject(wf.str);
Py_DECREF(wf.str);
}
return res;
@ -1136,9 +1136,9 @@ marshal_load(PyObject *self, PyObject *f)
rf.ptr = PyString_AS_STRING(data);
rf.end = rf.ptr + PyString_GET_SIZE(data);
}
else if (PyBytes_Check(data)) {
rf.ptr = PyBytes_AS_STRING(data);
rf.end = rf.ptr + PyBytes_GET_SIZE(data);
else if (PyByteArray_Check(data)) {
rf.ptr = PyByteArray_AS_STRING(data);
rf.end = rf.ptr + PyByteArray_GET_SIZE(data);
}
else {
PyErr_Format(PyExc_TypeError,

View file

@ -175,7 +175,7 @@ Py_InitializeEx(int install_sigs)
if (!_PyLong_Init())
Py_FatalError("Py_Initialize: can't init longs");
if (!PyBytes_Init())
if (!PyByteArray_Init())
Py_FatalError("Py_Initialize: can't init bytes");
_PyFloat_Init();
@ -460,7 +460,7 @@ Py_Finalize(void)
PyList_Fini();
PySet_Fini();
PyString_Fini();
PyBytes_Fini();
PyByteArray_Fini();
PyLong_Fini();
PyFloat_Fini();
PyDict_Fini();