@@ -13,10 +13,9 @@ class bytearray "PyByteArrayObject *" "&PyByteArray_Type"
1313[clinic start generated code]*/
1414/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5535b77c37a119e0]*/
1515
16+ /* For PyByteArray_AS_STRING(). */
1617char _PyByteArray_empty_string [] = "" ;
1718
18- /* end nullbytes support */
19-
2019/* Helpers */
2120
2221static int
@@ -266,7 +265,7 @@ PyByteArray_Concat(PyObject *a, PyObject *b)
266265
267266 result = (PyByteArrayObject * ) \
268267 PyByteArray_FromStringAndSize (NULL , va .len + vb .len );
269- // result->ob_bytes is NULL if result is an empty string :
268+ // result->ob_bytes is NULL if result is an empty bytearray :
270269 // if va.len + vb.len equals zero.
271270 if (result != NULL && result -> ob_bytes != NULL ) {
272271 memcpy (result -> ob_bytes , va .buf , va .len );
@@ -1007,9 +1006,6 @@ bytearray_richcompare(PyObject *self, PyObject *other, int op)
10071006 Py_buffer self_bytes , other_bytes ;
10081007 int cmp ;
10091008
1010- /* Bytes can be compared to anything that supports the (binary)
1011- buffer API. Except that a comparison with Unicode is always an
1012- error, even if the comparison is for equality. */
10131009 if (!PyObject_CheckBuffer (self ) || !PyObject_CheckBuffer (other )) {
10141010 if (PyUnicode_Check (self ) || PyUnicode_Check (other )) {
10151011 if (_Py_GetConfig ()-> bytes_warning && (op == Py_EQ || op == Py_NE )) {
@@ -1021,6 +1017,7 @@ bytearray_richcompare(PyObject *self, PyObject *other, int op)
10211017 Py_RETURN_NOTIMPLEMENTED ;
10221018 }
10231019
1020+ /* Bytearrays can be compared to anything that supports the buffer API. */
10241021 if (PyObject_GetBuffer (self , & self_bytes , PyBUF_SIMPLE ) != 0 ) {
10251022 PyErr_Clear ();
10261023 Py_RETURN_NOTIMPLEMENTED ;
@@ -1328,7 +1325,7 @@ bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
13281325 if (trans_table [c ] != -1 )
13291326 * output ++ = (char )trans_table [c ];
13301327 }
1331- /* Fix the size of the resulting string */
1328+ /* Fix the size of the resulting bytearray */
13321329 if (inlen > 0 )
13331330 if (PyByteArray_Resize (result , output - output_start ) < 0 ) {
13341331 Py_CLEAR (result );
@@ -2083,7 +2080,7 @@ bytearray.hex
20832080 How many bytes between separators. Positive values count from the
20842081 right, negative values count from the left.
20852082
2086- Create a str of hexadecimal numbers from a bytearray object.
2083+ Create a string of hexadecimal numbers from a bytearray object.
20872084
20882085Example:
20892086>>> value = bytearray([0xb9, 0x01, 0xef])
@@ -2099,7 +2096,7 @@ Create a str of hexadecimal numbers from a bytearray object.
20992096
21002097static PyObject *
21012098bytearray_hex_impl (PyByteArrayObject * self , PyObject * sep , int bytes_per_sep )
2102- /*[clinic end generated code: output=29c4e5ef72c565a0 input=814c15830ac8c4b5 ]*/
2099+ /*[clinic end generated code: output=29c4e5ef72c565a0 input=808667e49bcccb54 ]*/
21032100{
21042101 char * argbuf = PyByteArray_AS_STRING (self );
21052102 Py_ssize_t arglen = PyByteArray_GET_SIZE (self );
@@ -2358,7 +2355,7 @@ PyTypeObject PyByteArray_Type = {
23582355 PyObject_Del , /* tp_free */
23592356};
23602357
2361- /*********************** Bytes Iterator ****************************/
2358+ /*********************** Bytearray Iterator ****************************/
23622359
23632360typedef struct {
23642361 PyObject_HEAD
0 commit comments