@@ -1028,7 +1028,7 @@ Wrapper classes
1028
1028
1029
1029
.. cpp :function :: bytes(handle h)
1030
1030
1031
- Performs a cast within Python. This is equivalent equivalent to
1031
+ Performs a cast within Python. This is equivalent to
1032
1032
the Python expression ``bytes(h) ``.
1033
1033
1034
1034
.. cpp :function :: bytes(const char * s)
@@ -1052,6 +1052,42 @@ Wrapper classes
1052
1052
Convert a Python ``bytes `` object into a byte buffer of length :cpp:func: `bytes::size() ` bytes.
1053
1053
1054
1054
1055
+ .. cpp :class :: bytearray: public object
1056
+
1057
+ This wrapper class represents Python ``bytearray `` instances.
1058
+
1059
+ .. cpp :function :: bytearray()
1060
+
1061
+ Create an empty ``bytearray ``.
1062
+
1063
+ .. cpp :function :: bytearray(handle h)
1064
+
1065
+ Performs a cast within Python. This is equivalent to
1066
+ the Python expression ``bytearray(h) ``.
1067
+
1068
+ .. cpp :function :: bytearray(const void * buf, size_t n)
1069
+
1070
+ Convert a byte buffer ``buf `` of length ``n `` bytes into a Python ``bytearray `` object. The buffer can contain embedded null bytes.
1071
+
1072
+ .. cpp :function :: const char * c_str () const
1073
+
1074
+ Convert a Python ``bytearray `` object into a null-terminated C-style string.
1075
+
1076
+ .. cpp :function :: size_t size () const
1077
+
1078
+ Return the size in bytes.
1079
+
1080
+ .. cpp :function :: const void * data () const
1081
+
1082
+ Convert a Python ``bytearray `` object into a byte buffer of length :cpp:func: `bytearray::size() ` bytes.
1083
+
1084
+ .. cpp :function :: void resize (size_t n)
1085
+
1086
+ Resize the internal buffer of a Python ``bytearray `` object to ``n ``. Any
1087
+ space added by this method, which calls `PyByteArray_Resize `, will not be
1088
+ initialized and may contain random data.
1089
+
1090
+
1055
1091
.. cpp :class :: type_object: public object
1056
1092
1057
1093
Wrapper class representing Python ``type `` instances.
0 commit comments