[Python-3000-checkins] r59649 - python/branches/py3k-grandrenaming/Objects/bytesobject.c python/branches/py3k-grandrenaming/Objects/stringobject.c

christian.heimes python-3000-checkins at python.org
Tue Jan 1 20:13:48 CET 2008


Author: christian.heimes
Date: Tue Jan  1 20:13:47 2008
New Revision: 59649

Modified:
   python/branches/py3k-grandrenaming/Objects/bytesobject.c
   python/branches/py3k-grandrenaming/Objects/stringobject.c
Log:
bytes_ -> bytearray_; string_ -> bytes_

Modified: python/branches/py3k-grandrenaming/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k-grandrenaming/Objects/bytesobject.c	(original)
+++ python/branches/py3k-grandrenaming/Objects/bytesobject.c	Tue Jan  1 20:13:47 2008
@@ -50,7 +50,7 @@
 }
 
 static int
-bytes_getbuffer(PyBytesObject *obj, Py_buffer *view, int flags)
+bytearray_getbuffer(PyBytesObject *obj, Py_buffer *view, int flags)
 {
         int ret;
         void *ptr;
@@ -70,7 +70,7 @@
 }
 
 static void
-bytes_releasebuffer(PyBytesObject *obj, Py_buffer *view)
+bytearray_releasebuffer(PyBytesObject *obj, Py_buffer *view)
 {
         obj->ob_exports--;
 }
@@ -246,13 +246,13 @@
 /* Functions stuffed into the type object */
 
 static Py_ssize_t
-bytes_length(PyBytesObject *self)
+bytearray_length(PyBytesObject *self)
 {
     return Py_SIZE(self);
 }
 
 static PyObject *
-bytes_iconcat(PyBytesObject *self, PyObject *other)
+bytearray_iconcat(PyBytesObject *self, PyObject *other)
 {
     Py_ssize_t mysize;
     Py_ssize_t size;
@@ -285,7 +285,7 @@
 }
 
 static PyObject *
-bytes_repeat(PyBytesObject *self, Py_ssize_t count)
+bytearray_repeat(PyBytesObject *self, Py_ssize_t count)
 {
     PyBytesObject *result;
     Py_ssize_t mysize;
@@ -311,7 +311,7 @@
 }
 
 static PyObject *
-bytes_irepeat(PyBytesObject *self, Py_ssize_t count)
+bytearray_irepeat(PyBytesObject *self, Py_ssize_t count)
 {
     Py_ssize_t mysize;
     Py_ssize_t size;
@@ -342,7 +342,7 @@
 }
 
 static PyObject *
-bytes_getitem(PyBytesObject *self, Py_ssize_t i)
+bytearray_getitem(PyBytesObject *self, Py_ssize_t i)
 {
     if (i < 0)
         i += Py_SIZE(self);
@@ -354,7 +354,7 @@
 }
 
 static PyObject *
-bytes_subscript(PyBytesObject *self, PyObject *item)
+bytearray_subscript(PyBytesObject *self, PyObject *item)
 {
     if (PyIndex_Check(item)) {
         Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
@@ -409,7 +409,7 @@
 }
 
 static int
-bytes_setslice(PyBytesObject *self, Py_ssize_t lo, Py_ssize_t hi,
+bytearray_setslice(PyBytesObject *self, Py_ssize_t lo, Py_ssize_t hi,
                PyObject *values)
 {
     Py_ssize_t avail, needed;
@@ -424,7 +424,7 @@
         values = PyBytes_FromObject(values);
         if (values == NULL)
             return -1;
-        err = bytes_setslice(self, lo, hi, values);
+        err = bytearray_setslice(self, lo, hi, values);
         Py_DECREF(values);
         return err;
     }
@@ -495,7 +495,7 @@
 }
 
 static int
-bytes_setitem(PyBytesObject *self, Py_ssize_t i, PyObject *value)
+bytearray_setitem(PyBytesObject *self, Py_ssize_t i, PyObject *value)
 {
     Py_ssize_t ival;
 
@@ -508,7 +508,7 @@
     }
 
     if (value == NULL)
-        return bytes_setslice(self, i, i+1, NULL);
+        return bytearray_setslice(self, i, i+1, NULL);
 
     ival = PyNumber_AsSsize_t(value, PyExc_ValueError);
     if (ival == -1 && PyErr_Occurred())
@@ -524,7 +524,7 @@
 }
 
 static int
-bytes_ass_subscript(PyBytesObject *self, PyObject *item, PyObject *values)
+bytearray_ass_subscript(PyBytesObject *self, PyObject *item, PyObject *values)
 {
     Py_ssize_t start, stop, step, slicelen, needed;
     char *bytes;
@@ -585,7 +585,7 @@
         values = PyBytes_FromObject(values);
         if (values == NULL)
             return -1;
-        err = bytes_ass_subscript(self, item, values);
+        err = bytearray_ass_subscript(self, item, values);
         Py_DECREF(values);
         return err;
     }
@@ -682,7 +682,7 @@
 }
 
 static int
-bytes_init(PyBytesObject *self, PyObject *args, PyObject *kwds)
+bytearray_init(PyBytesObject *self, PyObject *args, PyObject *kwds)
 {
     static char *kwlist[] = {"source", "encoding", "errors", 0};
     PyObject *arg = NULL;
@@ -725,7 +725,7 @@
         if (encoded == NULL)
             return -1;
         assert(PyString_Check(encoded));
-        new = bytes_iconcat(self, encoded);
+        new = bytearray_iconcat(self, encoded);
         Py_DECREF(encoded);
         if (new == NULL)
             return -1;
@@ -832,7 +832,7 @@
 /* Mostly copied from string_repr, but without the
    "smart quote" functionality. */
 static PyObject *
-bytes_repr(PyBytesObject *self)
+bytearray_repr(PyBytesObject *self)
 {
     static const char *hexdigits = "0123456789abcdef";
     const char *quote_prefix = "bytearray(b";
@@ -917,18 +917,18 @@
 }
 
 static PyObject *
-bytes_str(PyObject *op)
+bytearray_str(PyObject *op)
 {
 	if (Py_BytesWarningFlag) {
 		if (PyErr_WarnEx(PyExc_BytesWarning,
 				 "str() on a bytearray instance", 1))
 			return NULL;
 	}
-	return bytes_repr((PyBytesObject*)op);
+	return bytearray_repr((PyBytesObject*)op);
 }
 
 static PyObject *
-bytes_richcompare(PyObject *self, PyObject *other, int op)
+bytearray_richcompare(PyObject *self, PyObject *other, int op)
 {
     Py_ssize_t self_size, other_size;
     Py_buffer self_bytes, other_bytes;
@@ -1003,7 +1003,7 @@
 }
 
 static void
-bytes_dealloc(PyBytesObject *self)
+bytearray_dealloc(PyBytesObject *self)
 {
     if (self->ob_bytes != 0) {
         PyMem_Free(self->ob_bytes);
@@ -1052,7 +1052,7 @@
 
 
 Py_LOCAL_INLINE(Py_ssize_t)
-bytes_find_internal(PyBytesObject *self, PyObject *args, int dir)
+bytearray_find_internal(PyBytesObject *self, PyObject *args, int dir)
 {
     PyObject *subobj;
     Py_buffer subbuf;
@@ -1086,9 +1086,9 @@
 Return -1 on failure.");
 
 static PyObject *
-bytes_find(PyBytesObject *self, PyObject *args)
+bytearray_find(PyBytesObject *self, PyObject *args)
 {
-    Py_ssize_t result = bytes_find_internal(self, args, +1);
+    Py_ssize_t result = bytearray_find_internal(self, args, +1);
     if (result == -2)
         return NULL;
     return PyLong_FromSsize_t(result);
@@ -1102,7 +1102,7 @@
 as in slice notation.");
 
 static PyObject *
-bytes_count(PyBytesObject *self, PyObject *args)
+bytearray_count(PyBytesObject *self, PyObject *args)
 {
     PyObject *sub_obj;
     const char *str = PyBytes_AS_STRING(self);
@@ -1133,9 +1133,9 @@
 Like B.find() but raise ValueError when the subsection is not found.");
 
 static PyObject *
-bytes_index(PyBytesObject *self, PyObject *args)
+bytearray_index(PyBytesObject *self, PyObject *args)
 {
-    Py_ssize_t result = bytes_find_internal(self, args, +1);
+    Py_ssize_t result = bytearray_find_internal(self, args, +1);
     if (result == -2)
         return NULL;
     if (result == -1) {
@@ -1157,9 +1157,9 @@
 Return -1 on failure.");
 
 static PyObject *
-bytes_rfind(PyBytesObject *self, PyObject *args)
+bytearray_rfind(PyBytesObject *self, PyObject *args)
 {
-    Py_ssize_t result = bytes_find_internal(self, args, -1);
+    Py_ssize_t result = bytearray_find_internal(self, args, -1);
     if (result == -2)
         return NULL;
     return PyLong_FromSsize_t(result);
@@ -1172,9 +1172,9 @@
 Like B.rfind() but raise ValueError when the subsection is not found.");
 
 static PyObject *
-bytes_rindex(PyBytesObject *self, PyObject *args)
+bytearray_rindex(PyBytesObject *self, PyObject *args)
 {
-    Py_ssize_t result = bytes_find_internal(self, args, -1);
+    Py_ssize_t result = bytearray_find_internal(self, args, -1);
     if (result == -2)
         return NULL;
     if (result == -1) {
@@ -1187,7 +1187,7 @@
 
 
 static int
-bytes_contains(PyObject *self, PyObject *arg)
+bytearray_contains(PyObject *self, PyObject *arg)
 {
     Py_ssize_t ival = PyNumber_AsSsize_t(arg, PyExc_ValueError);
     if (ival == -1 && PyErr_Occurred()) {
@@ -1262,7 +1262,7 @@
 prefix can also be a tuple of strings to try.");
 
 static PyObject *
-bytes_startswith(PyBytesObject *self, PyObject *args)
+bytearray_startswith(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t start = 0;
     Py_ssize_t end = PY_SSIZE_T_MAX;
@@ -1302,7 +1302,7 @@
 suffix can also be a tuple of strings to try.");
 
 static PyObject *
-bytes_endswith(PyBytesObject *self, PyObject *args)
+bytearray_endswith(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t start = 0;
     Py_ssize_t end = PY_SSIZE_T_MAX;
@@ -1343,7 +1343,7 @@
 table, which must be a bytes object of length 256.");
 
 static PyObject *
-bytes_translate(PyBytesObject *self, PyObject *args)
+bytearray_translate(PyBytesObject *self, PyObject *args)
 {
     register char *input, *output;
     register const char *table;
@@ -2040,7 +2040,7 @@
 given, only the first count occurrences are replaced.");
 
 static PyObject *
-bytes_replace(PyBytesObject *self, PyObject *args)
+bytearray_replace(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t count = -1;
     PyObject *from, *to, *res;
@@ -2191,7 +2191,7 @@
 If maxsplit is given, at most maxsplit splits are done.");
 
 static PyObject *
-bytes_split(PyBytesObject *self, PyObject *args)
+bytearray_split(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t len = PyBytes_GET_SIZE(self), n, i, j;
     Py_ssize_t maxsplit = -1, count = 0;
@@ -2295,7 +2295,7 @@
 found, returns B and two empty bytearray objects.");
 
 static PyObject *
-bytes_partition(PyBytesObject *self, PyObject *sep_obj)
+bytearray_partition(PyBytesObject *self, PyObject *sep_obj)
 {
     PyObject *bytesep, *result;
 
@@ -2323,7 +2323,7 @@
 bytearray objects and B.");
 
 static PyObject *
-bytes_rpartition(PyBytesObject *self, PyObject *sep_obj)
+bytearray_rpartition(PyBytesObject *self, PyObject *sep_obj)
 {
     PyObject *bytesep, *result;
 
@@ -2426,7 +2426,7 @@
 If maxsplit is given, at most maxsplit splits are done.");
 
 static PyObject *
-bytes_rsplit(PyBytesObject *self, PyObject *args)
+bytearray_rsplit(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t len = PyBytes_GET_SIZE(self), n, i, j;
     Py_ssize_t maxsplit = -1, count = 0;
@@ -2492,7 +2492,7 @@
 \n\
 Reverse the order of the values in B in place.");
 static PyObject *
-bytes_reverse(PyBytesObject *self, PyObject *unused)
+bytearray_reverse(PyBytesObject *self, PyObject *unused)
 {
     char swap, *head, *tail;
     Py_ssize_t i, j, n = Py_SIZE(self);
@@ -2514,7 +2514,7 @@
 \n\
 Insert a single item into the bytearray before the given index.");
 static PyObject *
-bytes_insert(PyBytesObject *self, PyObject *args)
+bytearray_insert(PyBytesObject *self, PyObject *args)
 {
     int value;
     Py_ssize_t where, n = Py_SIZE(self);
@@ -2553,7 +2553,7 @@
 \n\
 Append a single item to the end of B.");
 static PyObject *
-bytes_append(PyBytesObject *self, PyObject *arg)
+bytearray_append(PyBytesObject *self, PyObject *arg)
 {
     int value;
     Py_ssize_t n = Py_SIZE(self);
@@ -2579,7 +2579,7 @@
 Append all the elements from the iterator or sequence to the\n\
 end of B.");
 static PyObject *
-bytes_extend(PyBytesObject *self, PyObject *arg)
+bytearray_extend(PyBytesObject *self, PyObject *arg)
 {
     PyObject *it, *item, *tmp, *res;
     Py_ssize_t buf_size = 0, len = 0;
@@ -2588,7 +2588,7 @@
 
     /* bytes_setslice code only accepts something supporting PEP 3118. */
     if (PyObject_CheckBuffer(arg)) {
-        if (bytes_setslice(self, Py_SIZE(self), Py_SIZE(self), arg) == -1)
+        if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), arg) == -1)
             return NULL;
 
         Py_RETURN_NONE;
@@ -2626,7 +2626,7 @@
 
     /* XXX: Is possible to avoid a full copy of the buffer? */
     tmp = PyBytes_FromStringAndSize(buf, len);
-    res = bytes_extend(self, tmp);
+    res = bytearray_extend(self, tmp);
     Py_DECREF(tmp);
     PyMem_Free(buf);
 
@@ -2639,7 +2639,7 @@
 Remove and return a single item from B. If no index\n\
 argument is give, will pop the last value.");
 static PyObject *
-bytes_pop(PyBytesObject *self, PyObject *args)
+bytearray_pop(PyBytesObject *self, PyObject *args)
 {
     int value;
     Py_ssize_t where = -1, n = Py_SIZE(self);
@@ -2672,7 +2672,7 @@
 \n\
 Remove the first occurance of a value in B.");
 static PyObject *
-bytes_remove(PyBytesObject *self, PyObject *arg)
+bytearray_remove(PyBytesObject *self, PyObject *arg)
 {
     int value;
     Py_ssize_t where, n = Py_SIZE(self);
@@ -2724,7 +2724,7 @@
 Strip leading and trailing bytes contained in the argument.\n\
 If the argument is omitted, strip ASCII whitespace.");
 static PyObject *
-bytes_strip(PyBytesObject *self, PyObject *args)
+bytearray_strip(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t left, right, mysize, argsize;
     void *myptr, *argptr;
@@ -2760,7 +2760,7 @@
 Strip leading bytes contained in the argument.\n\
 If the argument is omitted, strip leading ASCII whitespace.");
 static PyObject *
-bytes_lstrip(PyBytesObject *self, PyObject *args)
+bytearray_lstrip(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t left, right, mysize, argsize;
     void *myptr, *argptr;
@@ -2793,7 +2793,7 @@
 Strip trailing bytes contained in the argument.\n\
 If the argument is omitted, strip trailing ASCII whitespace.");
 static PyObject *
-bytes_rstrip(PyBytesObject *self, PyObject *args)
+bytearray_rstrip(PyBytesObject *self, PyObject *args)
 {
     Py_ssize_t left, right, mysize, argsize;
     void *myptr, *argptr;
@@ -2831,7 +2831,7 @@
 able to handle UnicodeDecodeErrors.");
 
 static PyObject *
-bytes_decode(PyObject *self, PyObject *args)
+bytearray_decode(PyObject *self, PyObject *args)
 {
     const char *encoding = NULL;
     const char *errors = NULL;
@@ -2849,7 +2849,7 @@
 Returns the number of bytes actually allocated.");
 
 static PyObject *
-bytes_alloc(PyBytesObject *self)
+bytearray_alloc(PyBytesObject *self)
 {
     return PyLong_FromSsize_t(self->ob_alloc);
 }
@@ -2860,7 +2860,7 @@
 Concatenates any number of bytearray objects, with B in between each pair.");
 
 static PyObject *
-bytes_join(PyBytesObject *self, PyObject *it)
+bytearray_join(PyBytesObject *self, PyObject *it)
 {
     PyObject *seq;
     Py_ssize_t mysize = Py_SIZE(self);
@@ -2953,7 +2953,7 @@
 }
 
 static PyObject *
-bytes_fromhex(PyObject *cls, PyObject *args)
+bytearray_fromhex(PyObject *cls, PyObject *args)
 {
     PyObject *newbytes, *hexobj;
     char *buf;
@@ -2999,7 +2999,7 @@
 PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
 
 static PyObject *
-bytes_reduce(PyBytesObject *self)
+bytearray_reduce(PyBytesObject *self)
 {
     PyObject *latin1, *dict;
     if (self->ob_bytes)
@@ -3018,49 +3018,49 @@
     return Py_BuildValue("(O(Ns)N)", Py_TYPE(self), latin1, "latin-1", dict);
 }
 
-static PySequenceMethods bytes_as_sequence = {
-    (lenfunc)bytes_length,              /* sq_length */
+static PySequenceMethods bytearray_as_sequence = {
+    (lenfunc)bytearray_length,              /* sq_length */
     (binaryfunc)PyBytes_Concat,         /* sq_concat */
-    (ssizeargfunc)bytes_repeat,         /* sq_repeat */
-    (ssizeargfunc)bytes_getitem,        /* sq_item */
+    (ssizeargfunc)bytearray_repeat,         /* sq_repeat */
+    (ssizeargfunc)bytearray_getitem,        /* sq_item */
     0,                                  /* sq_slice */
-    (ssizeobjargproc)bytes_setitem,     /* sq_ass_item */
+    (ssizeobjargproc)bytearray_setitem,     /* sq_ass_item */
     0,                                  /* sq_ass_slice */
-    (objobjproc)bytes_contains,         /* sq_contains */
-    (binaryfunc)bytes_iconcat,          /* sq_inplace_concat */
-    (ssizeargfunc)bytes_irepeat,        /* sq_inplace_repeat */
+    (objobjproc)bytearray_contains,         /* sq_contains */
+    (binaryfunc)bytearray_iconcat,          /* sq_inplace_concat */
+    (ssizeargfunc)bytearray_irepeat,        /* sq_inplace_repeat */
 };
 
-static PyMappingMethods bytes_as_mapping = {
-    (lenfunc)bytes_length,
-    (binaryfunc)bytes_subscript,
-    (objobjargproc)bytes_ass_subscript,
+static PyMappingMethods bytearray_as_mapping = {
+    (lenfunc)bytearray_length,
+    (binaryfunc)bytearray_subscript,
+    (objobjargproc)bytearray_ass_subscript,
 };
 
-static PyBufferProcs bytes_as_buffer = {
-    (getbufferproc)bytes_getbuffer,
-    (releasebufferproc)bytes_releasebuffer,
+static PyBufferProcs bytearray_as_buffer = {
+    (getbufferproc)bytearray_getbuffer,
+    (releasebufferproc)bytearray_releasebuffer,
 };
 
 static PyMethodDef
-bytes_methods[] = {
-    {"__alloc__", (PyCFunction)bytes_alloc, METH_NOARGS, alloc_doc},
-    {"__reduce__", (PyCFunction)bytes_reduce, METH_NOARGS, reduce_doc},
-    {"append", (PyCFunction)bytes_append, METH_O, append__doc__},
+bytearray_methods[] = {
+    {"__alloc__", (PyCFunction)bytearray_alloc, METH_NOARGS, alloc_doc},
+    {"__reduce__", (PyCFunction)bytearray_reduce, METH_NOARGS, reduce_doc},
+    {"append", (PyCFunction)bytearray_append, METH_O, append__doc__},
     {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS,
      _Py_capitalize__doc__},
     {"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__},
-    {"count", (PyCFunction)bytes_count, METH_VARARGS, count__doc__},
-    {"decode", (PyCFunction)bytes_decode, METH_VARARGS, decode_doc},
-    {"endswith", (PyCFunction)bytes_endswith, METH_VARARGS, endswith__doc__},
+    {"count", (PyCFunction)bytearray_count, METH_VARARGS, count__doc__},
+    {"decode", (PyCFunction)bytearray_decode, METH_VARARGS, decode_doc},
+    {"endswith", (PyCFunction)bytearray_endswith, METH_VARARGS, endswith__doc__},
     {"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS,
      expandtabs__doc__},
-    {"extend", (PyCFunction)bytes_extend, METH_O, extend__doc__},
-    {"find", (PyCFunction)bytes_find, METH_VARARGS, find__doc__},
-    {"fromhex", (PyCFunction)bytes_fromhex, METH_VARARGS|METH_CLASS,
+    {"extend", (PyCFunction)bytearray_extend, METH_O, extend__doc__},
+    {"find", (PyCFunction)bytearray_find, METH_VARARGS, find__doc__},
+    {"fromhex", (PyCFunction)bytearray_fromhex, METH_VARARGS|METH_CLASS,
      fromhex_doc},
-    {"index", (PyCFunction)bytes_index, METH_VARARGS, index__doc__},
-    {"insert", (PyCFunction)bytes_insert, METH_VARARGS, insert__doc__},
+    {"index", (PyCFunction)bytearray_index, METH_VARARGS, index__doc__},
+    {"insert", (PyCFunction)bytearray_insert, METH_VARARGS, insert__doc__},
     {"isalnum", (PyCFunction)stringlib_isalnum, METH_NOARGS,
      _Py_isalnum__doc__},
     {"isalpha", (PyCFunction)stringlib_isalpha, METH_NOARGS,
@@ -3075,38 +3075,38 @@
      _Py_istitle__doc__},
     {"isupper", (PyCFunction)stringlib_isupper, METH_NOARGS,
      _Py_isupper__doc__},
-    {"join", (PyCFunction)bytes_join, METH_O, join_doc},
+    {"join", (PyCFunction)bytearray_join, METH_O, join_doc},
     {"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__},
     {"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__},
-    {"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, lstrip__doc__},
-    {"partition", (PyCFunction)bytes_partition, METH_O, partition__doc__},
-    {"pop", (PyCFunction)bytes_pop, METH_VARARGS, pop__doc__},
-    {"remove", (PyCFunction)bytes_remove, METH_O, remove__doc__},
-    {"replace", (PyCFunction)bytes_replace, METH_VARARGS, replace__doc__},
-    {"reverse", (PyCFunction)bytes_reverse, METH_NOARGS, reverse__doc__},
-    {"rfind", (PyCFunction)bytes_rfind, METH_VARARGS, rfind__doc__},
-    {"rindex", (PyCFunction)bytes_rindex, METH_VARARGS, rindex__doc__},
+    {"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, lstrip__doc__},
+    {"partition", (PyCFunction)bytearray_partition, METH_O, partition__doc__},
+    {"pop", (PyCFunction)bytearray_pop, METH_VARARGS, pop__doc__},
+    {"remove", (PyCFunction)bytearray_remove, METH_O, remove__doc__},
+    {"replace", (PyCFunction)bytearray_replace, METH_VARARGS, replace__doc__},
+    {"reverse", (PyCFunction)bytearray_reverse, METH_NOARGS, reverse__doc__},
+    {"rfind", (PyCFunction)bytearray_rfind, METH_VARARGS, rfind__doc__},
+    {"rindex", (PyCFunction)bytearray_rindex, METH_VARARGS, rindex__doc__},
     {"rjust", (PyCFunction)stringlib_rjust, METH_VARARGS, rjust__doc__},
-    {"rpartition", (PyCFunction)bytes_rpartition, METH_O, rpartition__doc__},
-    {"rsplit", (PyCFunction)bytes_rsplit, METH_VARARGS, rsplit__doc__},
-    {"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, rstrip__doc__},
-    {"split", (PyCFunction)bytes_split, METH_VARARGS, split__doc__},
+    {"rpartition", (PyCFunction)bytearray_rpartition, METH_O, rpartition__doc__},
+    {"rsplit", (PyCFunction)bytearray_rsplit, METH_VARARGS, rsplit__doc__},
+    {"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, rstrip__doc__},
+    {"split", (PyCFunction)bytearray_split, METH_VARARGS, split__doc__},
     {"splitlines", (PyCFunction)stringlib_splitlines, METH_VARARGS,
      splitlines__doc__},
-    {"startswith", (PyCFunction)bytes_startswith, METH_VARARGS ,
+    {"startswith", (PyCFunction)bytearray_startswith, METH_VARARGS ,
      startswith__doc__},
-    {"strip", (PyCFunction)bytes_strip, METH_VARARGS, strip__doc__},
+    {"strip", (PyCFunction)bytearray_strip, METH_VARARGS, strip__doc__},
     {"swapcase", (PyCFunction)stringlib_swapcase, METH_NOARGS,
      _Py_swapcase__doc__},
     {"title", (PyCFunction)stringlib_title, METH_NOARGS, _Py_title__doc__},
-    {"translate", (PyCFunction)bytes_translate, METH_VARARGS,
+    {"translate", (PyCFunction)bytearray_translate, METH_VARARGS,
      translate__doc__},
     {"upper", (PyCFunction)stringlib_upper, METH_NOARGS, _Py_upper__doc__},
     {"zfill", (PyCFunction)stringlib_zfill, METH_VARARGS, zfill__doc__},
     {NULL}
 };
 
-PyDoc_STRVAR(bytes_doc,
+PyDoc_STRVAR(bytearray_doc,
 "bytearray(iterable_of_ints) -> bytearray.\n\
 bytearray(string, encoding[, errors]) -> bytearray.\n\
 bytearray(bytes_or_bytearray) -> mutable copy of bytes_or_bytearray.\n\
@@ -3123,37 +3123,37 @@
 Construct a zero-initialized bytearray of the given length.");
 
 
-static PyObject *bytes_iter(PyObject *seq);
+static PyObject *bytearray_iter(PyObject *seq);
 
 PyTypeObject PyBytes_Type = {
     PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "bytearray",
     sizeof(PyBytesObject),
     0,
-    (destructor)bytes_dealloc,          /* tp_dealloc */
+    (destructor)bytearray_dealloc,          /* tp_dealloc */
     0,                                  /* tp_print */
     0,                                  /* tp_getattr */
     0,                                  /* tp_setattr */
     0,                                  /* tp_compare */
-    (reprfunc)bytes_repr,               /* tp_repr */
+    (reprfunc)bytearray_repr,               /* tp_repr */
     0,                                  /* tp_as_number */
-    &bytes_as_sequence,                 /* tp_as_sequence */
-    &bytes_as_mapping,                  /* tp_as_mapping */
+    &bytearray_as_sequence,             /* tp_as_sequence */
+    &bytearray_as_mapping,              /* tp_as_mapping */
     0,                                  /* tp_hash */
     0,                                  /* tp_call */
-    bytes_str,                          /* tp_str */
+    bytearray_str,                      /* tp_str */
     PyObject_GenericGetAttr,            /* tp_getattro */
     0,                                  /* tp_setattro */
-    &bytes_as_buffer,                   /* tp_as_buffer */
+    &bytearray_as_buffer,               /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
-    bytes_doc,                          /* tp_doc */
+    bytearray_doc,                          /* tp_doc */
     0,                                  /* tp_traverse */
     0,                                  /* tp_clear */
-    (richcmpfunc)bytes_richcompare,     /* tp_richcompare */
+    (richcmpfunc)bytearray_richcompare,     /* tp_richcompare */
     0,                                  /* tp_weaklistoffset */
-    bytes_iter,                         /* tp_iter */
+    bytearray_iter,                     /* tp_iter */
     0,                                  /* tp_iternext */
-    bytes_methods,                      /* tp_methods */
+    bytearray_methods,                  /* tp_methods */
     0,                                  /* tp_members */
     0,                                  /* tp_getset */
     0,                                  /* tp_base */
@@ -3161,7 +3161,7 @@
     0,                                  /* tp_descr_get */
     0,                                  /* tp_descr_set */
     0,                                  /* tp_dictoffset */
-    (initproc)bytes_init,               /* tp_init */
+    (initproc)bytearray_init,               /* tp_init */
     PyType_GenericAlloc,                /* tp_alloc */
     PyType_GenericNew,                  /* tp_new */
     PyObject_Del,                       /* tp_free */
@@ -3176,7 +3176,7 @@
 } bytesiterobject;
 
 static void
-bytesiter_dealloc(bytesiterobject *it)
+bytearrayiter_dealloc(bytesiterobject *it)
 {
     _PyObject_GC_UNTRACK(it);
     Py_XDECREF(it->it_seq);
@@ -3184,14 +3184,14 @@
 }
 
 static int
-bytesiter_traverse(bytesiterobject *it, visitproc visit, void *arg)
+bytearrayiter_traverse(bytesiterobject *it, visitproc visit, void *arg)
 {
     Py_VISIT(it->it_seq);
     return 0;
 }
 
 static PyObject *
-bytesiter_next(bytesiterobject *it)
+bytearrayiter_next(bytesiterobject *it)
 {
     PyBytesObject *seq;
     PyObject *item;
@@ -3216,7 +3216,7 @@
 }
 
 static PyObject *
-bytesiter_length_hint(bytesiterobject *it)
+bytearrayiter_length_hint(bytesiterobject *it)
 {
     Py_ssize_t len = 0;
     if (it->it_seq)
@@ -3228,7 +3228,7 @@
     "Private method returning an estimate of len(list(it)).");
 
 static PyMethodDef bytesiter_methods[] = {
-    {"__length_hint__", (PyCFunction)bytesiter_length_hint, METH_NOARGS,
+    {"__length_hint__", (PyCFunction)bytearrayiter_length_hint, METH_NOARGS,
      length_hint_doc},
     {NULL, NULL} /* sentinel */
 };
@@ -3239,7 +3239,7 @@
     sizeof(bytesiterobject),           /* tp_basicsize */
     0,                                 /* tp_itemsize */
     /* methods */
-    (destructor)bytesiter_dealloc,     /* tp_dealloc */
+    (destructor)bytearrayiter_dealloc,     /* tp_dealloc */
     0,                                 /* tp_print */
     0,                                 /* tp_getattr */
     0,                                 /* tp_setattr */
@@ -3256,18 +3256,18 @@
     0,                                 /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
     0,                                 /* tp_doc */
-    (traverseproc)bytesiter_traverse,  /* tp_traverse */
+    (traverseproc)bytearrayiter_traverse,  /* tp_traverse */
     0,                                 /* tp_clear */
     0,                                 /* tp_richcompare */
     0,                                 /* tp_weaklistoffset */
     PyObject_SelfIter,                 /* tp_iter */
-    (iternextfunc)bytesiter_next,      /* tp_iternext */
+    (iternextfunc)bytearrayiter_next,      /* tp_iternext */
     bytesiter_methods,                 /* tp_methods */
     0,
 };
 
 static PyObject *
-bytes_iter(PyObject *seq)
+bytearray_iter(PyObject *seq)
 {
     bytesiterobject *it;
 

Modified: python/branches/py3k-grandrenaming/Objects/stringobject.c
==============================================================================
--- python/branches/py3k-grandrenaming/Objects/stringobject.c	(original)
+++ python/branches/py3k-grandrenaming/Objects/stringobject.c	Tue Jan  1 20:13:47 2008
@@ -349,7 +349,7 @@
 }
 
 static void
-string_dealloc(PyObject *op)
+bytes_dealloc(PyObject *op)
 {
 	Py_TYPE(op)->tp_free(op);
 }
@@ -495,7 +495,7 @@
 /* object api */
 
 static Py_ssize_t
-string_getsize(register PyObject *op)
+bytes_getsize(register PyObject *op)
 {
 	char *s;
 	Py_ssize_t len;
@@ -508,7 +508,7 @@
 PyString_Size(register PyObject *op)
 {
 	if (!PyString_Check(op))
-		return string_getsize(op);
+		return bytes_getsize(op);
 	return Py_SIZE(op);
 }
 
@@ -649,31 +649,31 @@
 }
 
 static PyObject *
-string_repr(PyObject *op)
+bytes_repr(PyObject *op)
 {
 	return PyString_Repr(op, 1);
 }
 
 static PyObject *
-string_str(PyObject *op)
+bytes_str(PyObject *op)
 {
 	if (Py_BytesWarningFlag) {
 		if (PyErr_WarnEx(PyExc_BytesWarning,
 				 "str() on a bytes instance", 1))
 			return NULL;
 	}
-	return string_repr(op);
+	return bytes_repr(op);
 }
 
 static Py_ssize_t
-string_length(PyStringObject *a)
+bytes_length(PyStringObject *a)
 {
 	return Py_SIZE(a);
 }
 
 /* This is also used by PyString_Concat() */
 static PyObject *
-string_concat(PyObject *a, PyObject *b)
+bytes_concat(PyObject *a, PyObject *b)
 {
 	Py_ssize_t size;
 	Py_buffer va, vb;
@@ -721,7 +721,7 @@
 }
 
 static PyObject *
-string_repeat(register PyStringObject *a, register Py_ssize_t n)
+bytes_repeat(register PyStringObject *a, register Py_ssize_t n)
 {
 	register Py_ssize_t i;
 	register Py_ssize_t j;
@@ -774,7 +774,7 @@
 }
 
 static int
-string_contains(PyObject *self, PyObject *arg)
+bytes_contains(PyObject *self, PyObject *arg)
 {
     Py_ssize_t ival = PyNumber_AsSsize_t(arg, PyExc_ValueError);
     if (ival == -1 && PyErr_Occurred()) {
@@ -797,7 +797,7 @@
 }
 
 static PyObject *
-string_item(PyStringObject *a, register Py_ssize_t i)
+bytes_item(PyStringObject *a, register Py_ssize_t i)
 {
 	if (i < 0 || i >= Py_SIZE(a)) {
 		PyErr_SetString(PyExc_IndexError, "string index out of range");
@@ -807,7 +807,7 @@
 }
 
 static PyObject*
-string_richcompare(PyStringObject *a, PyStringObject *b, int op)
+bytes_richcompare(PyStringObject *a, PyStringObject *b, int op)
 {
 	int c;
 	Py_ssize_t len_a, len_b;
@@ -878,7 +878,7 @@
 }
 
 static long
-string_hash(PyStringObject *a)
+bytes_hash(PyStringObject *a)
 {
 	register Py_ssize_t len;
 	register unsigned char *p;
@@ -899,7 +899,7 @@
 }
 
 static PyObject*
-string_subscript(PyStringObject* self, PyObject* item)
+bytes_subscript(PyStringObject* self, PyObject* item)
 {
 	if (PyIndex_Check(item)) {
 		Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
@@ -966,31 +966,31 @@
 }
 
 static int
-string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags)
+bytes_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags)
 {
 	return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self),
 				 0, flags);
 }
 
-static PySequenceMethods string_as_sequence = {
-	(lenfunc)string_length, /*sq_length*/
-	(binaryfunc)string_concat, /*sq_concat*/
-	(ssizeargfunc)string_repeat, /*sq_repeat*/
-	(ssizeargfunc)string_item, /*sq_item*/
+static PySequenceMethods bytes_as_sequence = {
+	(lenfunc)bytes_length, /*sq_length*/
+	(binaryfunc)bytes_concat, /*sq_concat*/
+	(ssizeargfunc)bytes_repeat, /*sq_repeat*/
+	(ssizeargfunc)bytes_item, /*sq_item*/
 	0,		/*sq_slice*/
 	0,		/*sq_ass_item*/
 	0,		/*sq_ass_slice*/
-	(objobjproc)string_contains /*sq_contains*/
+	(objobjproc)bytes_contains /*sq_contains*/
 };
 
-static PyMappingMethods string_as_mapping = {
-	(lenfunc)string_length,
-	(binaryfunc)string_subscript,
+static PyMappingMethods bytes_as_mapping = {
+	(lenfunc)bytes_length,
+	(binaryfunc)bytes_subscript,
 	0,
 };
 
-static PyBufferProcs string_as_buffer = {
-	(getbufferproc)string_buffer_getbuffer,
+static PyBufferProcs bytes_as_buffer = {
+	(getbufferproc)bytes_buffer_getbuffer,
 	NULL,
 };
 
@@ -1140,7 +1140,7 @@
 If maxsplit is given, at most maxsplit splits are done.");
 
 static PyObject *
-string_split(PyStringObject *self, PyObject *args)
+bytes_split(PyStringObject *self, PyObject *args)
 {
 	Py_ssize_t len = PyString_GET_SIZE(self), n, i, j;
 	Py_ssize_t maxsplit = -1, count=0;
@@ -1217,7 +1217,7 @@
 found, returns B and two empty bytes objects.");
 
 static PyObject *
-string_partition(PyStringObject *self, PyObject *sep_obj)
+bytes_partition(PyStringObject *self, PyObject *sep_obj)
 {
 	const char *sep;
 	Py_ssize_t sep_len;
@@ -1245,7 +1245,7 @@
 bytes objects and B.");
 
 static PyObject *
-string_rpartition(PyStringObject *self, PyObject *sep_obj)
+bytes_rpartition(PyStringObject *self, PyObject *sep_obj)
 {
 	const char *sep;
 	Py_ssize_t sep_len;
@@ -1359,7 +1359,7 @@
 
 
 static PyObject *
-string_rsplit(PyStringObject *self, PyObject *args)
+bytes_rsplit(PyStringObject *self, PyObject *args)
 {
 	Py_ssize_t len = PyString_GET_SIZE(self), n, i, j;
 	Py_ssize_t maxsplit = -1, count=0;
@@ -1431,7 +1431,7 @@
 Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.");
 
 static PyObject *
-string_join(PyObject *self, PyObject *orig)
+bytes_join(PyObject *self, PyObject *orig)
 {
 	char *sep = PyString_AS_STRING(self);
 	const Py_ssize_t seplen = PyString_GET_SIZE(self);
@@ -1526,11 +1526,11 @@
 {
 	assert(sep != NULL && PyString_Check(sep));
 	assert(x != NULL);
-	return string_join(sep, x);
+	return bytes_join(sep, x);
 }
 
 Py_LOCAL_INLINE(void)
-string_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len)
+bytes_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len)
 {
 	if (*end > len)
 		*end = len;
@@ -1545,7 +1545,7 @@
 }
 
 Py_LOCAL_INLINE(Py_ssize_t)
-string_find_internal(PyStringObject *self, PyObject *args, int dir)
+bytes_find_internal(PyStringObject *self, PyObject *args, int dir)
 {
 	PyObject *subobj;
 	const char *sub;
@@ -1596,9 +1596,9 @@
 Return -1 on failure.");
 
 static PyObject *
-string_find(PyStringObject *self, PyObject *args)
+bytes_find(PyStringObject *self, PyObject *args)
 {
-	Py_ssize_t result = string_find_internal(self, args, +1);
+	Py_ssize_t result = bytes_find_internal(self, args, +1);
 	if (result == -2)
 		return NULL;
 	return PyLong_FromSsize_t(result);
@@ -1611,9 +1611,9 @@
 Like B.find() but raise ValueError when the substring is not found.");
 
 static PyObject *
-string_index(PyStringObject *self, PyObject *args)
+bytes_index(PyStringObject *self, PyObject *args)
 {
-	Py_ssize_t result = string_find_internal(self, args, +1);
+	Py_ssize_t result = bytes_find_internal(self, args, +1);
 	if (result == -2)
 		return NULL;
 	if (result == -1) {
@@ -1635,9 +1635,9 @@
 Return -1 on failure.");
 
 static PyObject *
-string_rfind(PyStringObject *self, PyObject *args)
+bytes_rfind(PyStringObject *self, PyObject *args)
 {
-	Py_ssize_t result = string_find_internal(self, args, -1);
+	Py_ssize_t result = bytes_find_internal(self, args, -1);
 	if (result == -2)
 		return NULL;
 	return PyLong_FromSsize_t(result);
@@ -1650,9 +1650,9 @@
 Like B.rfind() but raise ValueError when the substring is not found.");
 
 static PyObject *
-string_rindex(PyStringObject *self, PyObject *args)
+bytes_rindex(PyStringObject *self, PyObject *args)
 {
-	Py_ssize_t result = string_find_internal(self, args, -1);
+	Py_ssize_t result = bytes_find_internal(self, args, -1);
 	if (result == -2)
 		return NULL;
 	if (result == -1) {
@@ -1756,7 +1756,7 @@
 Strip leading and trailing bytes contained in the argument.\n\
 If the argument is omitted, strip trailing ASCII whitespace.");
 static PyObject *
-string_strip(PyStringObject *self, PyObject *args)
+bytes_strip(PyStringObject *self, PyObject *args)
 {
 	if (PyTuple_GET_SIZE(args) == 0)
 		return do_strip(self, BOTHSTRIP); /* Common case */
@@ -1771,7 +1771,7 @@
 Strip leading bytes contained in the argument.\n\
 If the argument is omitted, strip leading ASCII whitespace.");
 static PyObject *
-string_lstrip(PyStringObject *self, PyObject *args)
+bytes_lstrip(PyStringObject *self, PyObject *args)
 {
 	if (PyTuple_GET_SIZE(args) == 0)
 		return do_strip(self, LEFTSTRIP); /* Common case */
@@ -1786,7 +1786,7 @@
 Strip trailing bytes contained in the argument.\n\
 If the argument is omitted, strip trailing ASCII whitespace.");
 static PyObject *
-string_rstrip(PyStringObject *self, PyObject *args)
+bytes_rstrip(PyStringObject *self, PyObject *args)
 {
 	if (PyTuple_GET_SIZE(args) == 0)
 		return do_strip(self, RIGHTSTRIP); /* Common case */
@@ -1803,7 +1803,7 @@
 as in slice notation.");
 
 static PyObject *
-string_count(PyStringObject *self, PyObject *args)
+bytes_count(PyStringObject *self, PyObject *args)
 {
 	PyObject *sub_obj;
 	const char *str = PyString_AS_STRING(self), *sub;
@@ -1821,7 +1821,7 @@
 	else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len))
 		return NULL;
 
-	string_adjust_indices(&start, &end, PyString_GET_SIZE(self));
+	bytes_adjust_indices(&start, &end, PyString_GET_SIZE(self));
 
 	return PyLong_FromSsize_t(
 		stringlib_count(str + start, end - start, sub, sub_len)
@@ -1838,7 +1838,7 @@
 table, which must be a bytes object of length 256.");
 
 static PyObject *
-string_translate(PyStringObject *self, PyObject *args)
+bytes_translate(PyStringObject *self, PyObject *args)
 {
 	register char *input, *output;
 	const char *table;
@@ -1979,7 +1979,7 @@
 }
 
 Py_LOCAL(Py_ssize_t)
-findstring(const char *target, Py_ssize_t target_len,
+findbytes(const char *target, Py_ssize_t target_len,
 	   const char *pattern, Py_ssize_t pattern_len,
 	   Py_ssize_t start,
 	   Py_ssize_t end,
@@ -2017,7 +2017,7 @@
 }
 
 Py_LOCAL_INLINE(Py_ssize_t)
-countstring(const char *target, Py_ssize_t target_len,
+countbytes(const char *target, Py_ssize_t target_len,
 	    const char *pattern, Py_ssize_t pattern_len,
 	    Py_ssize_t start,
 	    Py_ssize_t end,
@@ -2174,7 +2174,7 @@
 /* len(self)>=1, len(from)>=2, to="", maxcount>=1 */
 
 Py_LOCAL(PyStringObject *)
-replace_delete_substring(PyStringObject *self,
+replace_delete_subbytes(PyStringObject *self,
 			 const char *from_s, Py_ssize_t from_len,
 			 Py_ssize_t maxcount) {
 	char *self_s, *result_s;
@@ -2186,7 +2186,7 @@
 	self_len = PyString_GET_SIZE(self);
 	self_s = PyString_AS_STRING(self);
 
-	count = countstring(self_s, self_len,
+	count = countbytes(self_s, self_len,
 			    from_s, from_len,
 			    0, self_len, 1,
 			    maxcount);
@@ -2208,7 +2208,7 @@
 	start = self_s;
 	end = self_s + self_len;
 	while (count-- > 0) {
-		offset = findstring(start, end-start,
+		offset = findbytes(start, end-start,
 				    from_s, from_len,
 				    0, end-start, FORWARD);
 		if (offset == -1)
@@ -2286,7 +2286,7 @@
 	self_s = PyString_AS_STRING(self);
 	self_len = PyString_GET_SIZE(self);
 
-	offset = findstring(self_s, self_len,
+	offset = findbytes(self_s, self_len,
 			    from_s, from_len,
 			    0, self_len, FORWARD);
 	if (offset == -1) {
@@ -2308,7 +2308,7 @@
 	end = result_s + self_len;
 
 	while ( --maxcount > 0) {
-		offset = findstring(start, end-start,
+		offset = findbytes(start, end-start,
 				    from_s, from_len,
 				    0, end-start, FORWARD);
 		if (offset==-1)
@@ -2391,7 +2391,7 @@
 
 /* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */
 Py_LOCAL(PyStringObject *)
-replace_substring(PyStringObject *self,
+replace_subbytes(PyStringObject *self,
 		  const char *from_s, Py_ssize_t from_len,
 		  const char *to_s, Py_ssize_t to_len,
 		  Py_ssize_t maxcount) {
@@ -2404,7 +2404,7 @@
 	self_s = PyString_AS_STRING(self);
 	self_len = PyString_GET_SIZE(self);
 
-	count = countstring(self_s, self_len,
+	count = countbytes(self_s, self_len,
 			    from_s, from_len,
 			    0, self_len, FORWARD, maxcount);
 	if (count == 0) {
@@ -2435,7 +2435,7 @@
 	start = self_s;
 	end = self_s + self_len;
 	while (count-- > 0) {
-		offset = findstring(start, end-start,
+		offset = findbytes(start, end-start,
 				    from_s, from_len,
 				    0, end-start, FORWARD);
 		if (offset == -1)
@@ -2503,7 +2503,7 @@
 			return replace_delete_single_character(
 				self, from_s[0], maxcount);
 		} else {
-			return replace_delete_substring(self, from_s,
+			return replace_delete_subbytes(self, from_s,
 							from_len, maxcount);
 		}
 	}
@@ -2530,7 +2530,7 @@
 						to_s, to_len, maxcount);
 	} else {
 		/* len('from')>=2, len('to')>=1 */
-		return replace_substring(self, from_s, from_len, to_s, to_len,
+		return replace_subbytes(self, from_s, from_len, to_s, to_len,
 					 maxcount);
 	}
 }
@@ -2543,7 +2543,7 @@
 given, only the first count occurrences are replaced.");
 
 static PyObject *
-string_replace(PyStringObject *self, PyObject *args)
+bytes_replace(PyStringObject *self, PyObject *args)
 {
 	Py_ssize_t count = -1;
 	PyObject *from, *to;
@@ -2595,7 +2595,7 @@
 		return -1;
 	str = PyString_AS_STRING(self);
 
-	string_adjust_indices(&start, &end, len);
+	bytes_adjust_indices(&start, &end, len);
 
 	if (direction < 0) {
 		/* startswith */
@@ -2624,7 +2624,7 @@
 prefix can also be a tuple of strings to try.");
 
 static PyObject *
-string_startswith(PyStringObject *self, PyObject *args)
+bytes_startswith(PyStringObject *self, PyObject *args)
 {
 	Py_ssize_t start = 0;
 	Py_ssize_t end = PY_SSIZE_T_MAX;
@@ -2665,7 +2665,7 @@
 suffix can also be a tuple of strings to try.");
 
 static PyObject *
-string_endswith(PyStringObject *self, PyObject *args)
+bytes_endswith(PyStringObject *self, PyObject *args)
 {
 	Py_ssize_t start = 0;
 	Py_ssize_t end = PY_SSIZE_T_MAX;
@@ -2708,7 +2708,7 @@
 able to handle UnicodeDecodeErrors.");
 
 static PyObject *
-string_decode(PyObject *self, PyObject *args)
+bytes_decode(PyObject *self, PyObject *args)
 {
 	const char *encoding = NULL;
 	const char *errors = NULL;
@@ -2745,7 +2745,7 @@
 }
 
 static PyObject *
-string_fromhex(PyObject *cls, PyObject *args)
+bytes_fromhex(PyObject *cls, PyObject *args)
 {
 	PyObject *newstring, *hexobj;
 	char *buf;
@@ -2790,28 +2790,28 @@
 
 
 static PyObject *
-string_getnewargs(PyStringObject *v)
+bytes_getnewargs(PyStringObject *v)
 {
 	return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v));
 }
 
 
 static PyMethodDef
-string_methods[] = {
-	{"__getnewargs__",	(PyCFunction)string_getnewargs,	METH_NOARGS},
+bytes_methods[] = {
+	{"__getnewargs__",	(PyCFunction)bytes_getnewargs,	METH_NOARGS},
 	{"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS,
 	 _Py_capitalize__doc__},
 	{"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__},
-	{"count", (PyCFunction)string_count, METH_VARARGS, count__doc__},
-	{"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__},
-	{"endswith", (PyCFunction)string_endswith, METH_VARARGS,
+	{"count", (PyCFunction)bytes_count, METH_VARARGS, count__doc__},
+	{"decode", (PyCFunction)bytes_decode, METH_VARARGS, decode__doc__},
+	{"endswith", (PyCFunction)bytes_endswith, METH_VARARGS,
          endswith__doc__},
 	{"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS,
 	 expandtabs__doc__},
-	{"find", (PyCFunction)string_find, METH_VARARGS, find__doc__},
-        {"fromhex", (PyCFunction)string_fromhex, METH_VARARGS|METH_CLASS,
+	{"find", (PyCFunction)bytes_find, METH_VARARGS, find__doc__},
+        {"fromhex", (PyCFunction)bytes_fromhex, METH_VARARGS|METH_CLASS,
          fromhex_doc},
-	{"index", (PyCFunction)string_index, METH_VARARGS, index__doc__},
+	{"index", (PyCFunction)bytes_index, METH_VARARGS, index__doc__},
 	{"isalnum", (PyCFunction)stringlib_isalnum, METH_NOARGS,
          _Py_isalnum__doc__},
 	{"isalpha", (PyCFunction)stringlib_isalpha, METH_NOARGS,
@@ -2826,29 +2826,29 @@
          _Py_istitle__doc__},
 	{"isupper", (PyCFunction)stringlib_isupper, METH_NOARGS,
          _Py_isupper__doc__},
-	{"join", (PyCFunction)string_join, METH_O, join__doc__},
+	{"join", (PyCFunction)bytes_join, METH_O, join__doc__},
 	{"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__},
 	{"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__},
-	{"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__},
-	{"partition", (PyCFunction)string_partition, METH_O, partition__doc__},
-	{"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__},
-	{"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__},
-	{"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__},
+	{"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, lstrip__doc__},
+	{"partition", (PyCFunction)bytes_partition, METH_O, partition__doc__},
+	{"replace", (PyCFunction)bytes_replace, METH_VARARGS, replace__doc__},
+	{"rfind", (PyCFunction)bytes_rfind, METH_VARARGS, rfind__doc__},
+	{"rindex", (PyCFunction)bytes_rindex, METH_VARARGS, rindex__doc__},
 	{"rjust", (PyCFunction)stringlib_rjust, METH_VARARGS, rjust__doc__},
-	{"rpartition", (PyCFunction)string_rpartition, METH_O,
+	{"rpartition", (PyCFunction)bytes_rpartition, METH_O,
 	 rpartition__doc__},
-	{"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__},
-	{"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__},
-	{"split", (PyCFunction)string_split, METH_VARARGS, split__doc__},
+	{"rsplit", (PyCFunction)bytes_rsplit, METH_VARARGS, rsplit__doc__},
+	{"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, rstrip__doc__},
+	{"split", (PyCFunction)bytes_split, METH_VARARGS, split__doc__},
 	{"splitlines", (PyCFunction)stringlib_splitlines, METH_VARARGS,
 	 splitlines__doc__},
-	{"startswith", (PyCFunction)string_startswith, METH_VARARGS,
+	{"startswith", (PyCFunction)bytes_startswith, METH_VARARGS,
          startswith__doc__},
-	{"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__},
+	{"strip", (PyCFunction)bytes_strip, METH_VARARGS, strip__doc__},
 	{"swapcase", (PyCFunction)stringlib_swapcase, METH_NOARGS,
 	 _Py_swapcase__doc__},
 	{"title", (PyCFunction)stringlib_title, METH_NOARGS, _Py_title__doc__},
-	{"translate", (PyCFunction)string_translate, METH_VARARGS,
+	{"translate", (PyCFunction)bytes_translate, METH_VARARGS,
 	 translate__doc__},
 	{"upper", (PyCFunction)stringlib_upper, METH_NOARGS, _Py_upper__doc__},
 	{"zfill", (PyCFunction)stringlib_zfill, METH_VARARGS, zfill__doc__},
@@ -2859,7 +2859,7 @@
 str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
 
 static PyObject *
-string_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	PyObject *x = NULL, *it;
 	const char *encoding = NULL;
@@ -3014,7 +3014,7 @@
 	Py_ssize_t n;
 
 	assert(PyType_IsSubtype(type, &PyString_Type));
-	tmp = string_new(&PyString_Type, args, kwds);
+	tmp = bytes_new(&PyString_Type, args, kwds);
 	if (tmp == NULL)
 		return NULL;
 	assert(PyString_CheckExact(tmp));
@@ -3030,7 +3030,7 @@
 	return pnew;
 }
 
-PyDoc_STRVAR(string_doc,
+PyDoc_STRVAR(bytes_doc,
 "bytes(iterable_of_ints) -> bytes.\n\
 bytes(string, encoding[, errors]) -> bytes\n\
 bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer.\n\
@@ -3042,38 +3042,38 @@
   - a bytes or a buffer object\n\
   - any object implementing the buffer API.");
 
-static PyObject *str_iter(PyObject *seq);
+static PyObject *bytes_iter(PyObject *seq);
 
 PyTypeObject PyString_Type = {
 	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"bytes",
 	sizeof(PyStringObject),
 	sizeof(char),
- 	string_dealloc, 			/* tp_dealloc */
+ 	bytes_dealloc, 				/* tp_dealloc */
 	0,			 		/* tp_print */
 	0,					/* tp_getattr */
 	0,					/* tp_setattr */
 	0,					/* tp_compare */
-	(reprfunc)string_repr, 			/* tp_repr */
+	(reprfunc)bytes_repr, 			/* tp_repr */
 	0,					/* tp_as_number */
-	&string_as_sequence,			/* tp_as_sequence */
-	&string_as_mapping,			/* tp_as_mapping */
-	(hashfunc)string_hash, 			/* tp_hash */
+	&bytes_as_sequence,			/* tp_as_sequence */
+	&bytes_as_mapping,			/* tp_as_mapping */
+	(hashfunc)bytes_hash, 			/* tp_hash */
 	0,					/* tp_call */
-	string_str,				/* tp_str */
+	bytes_str,				/* tp_str */
 	PyObject_GenericGetAttr,		/* tp_getattro */
 	0,					/* tp_setattro */
-	&string_as_buffer,			/* tp_as_buffer */
+	&bytes_as_buffer,			/* tp_as_buffer */
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
 		Py_TPFLAGS_STRING_SUBCLASS,	/* tp_flags */
-	string_doc,				/* tp_doc */
+	bytes_doc,				/* tp_doc */
 	0,					/* tp_traverse */
 	0,					/* tp_clear */
-	(richcmpfunc)string_richcompare,	/* tp_richcompare */
+	(richcmpfunc)bytes_richcompare,	/* tp_richcompare */
 	0,					/* tp_weaklistoffset */
-	str_iter,				/* tp_iter */
+	bytes_iter,				/* tp_iter */
 	0,					/* tp_iternext */
-	string_methods,				/* tp_methods */
+	bytes_methods,				/* tp_methods */
 	0,					/* tp_members */
 	0,					/* tp_getset */
 	&PyBaseObject_Type,			/* tp_base */
@@ -3083,7 +3083,7 @@
 	0,					/* tp_dictoffset */
 	0,					/* tp_init */
 	0,					/* tp_alloc */
-	string_new,				/* tp_new */
+	bytes_new,				/* tp_new */
 	PyObject_Del,	                	/* tp_free */
 };
 
@@ -3099,7 +3099,7 @@
 		*pv = NULL;
 		return;
 	}
-	v = string_concat(*pv, w);
+	v = bytes_concat(*pv, w);
 	Py_DECREF(*pv);
 	*pv = v;
 }
@@ -3411,7 +3411,7 @@
 };
 
 static PyObject *
-str_iter(PyObject *seq)
+bytes_iter(PyObject *seq)
 {
 	striterobject *it;
 


More information about the Python-3000-checkins mailing list