字节数组对象¶
- 
PyTypeObject PyByteArray_Type¶
- Python bytearray 类型表示为 - PyTypeObject的实例;这与Python层面的- bytearray是相同的对象。
类型检查宏¶
直接 API 函数¶
- 
PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)¶
- Create a new bytearray object from string and its length, len. On failure, NULL is returned. 
- 
Py_ssize_t PyByteArray_Size(PyObject *bytearray)¶
- Return the size of bytearray after checking for a NULL pointer. 
宏¶
这些宏减低安全性以换取性能,它们不检查指针。
- 
char* PyByteArray_AS_STRING(PyObject *bytearray)¶
- C函数 - PyByteArray_AsString()的宏版本。
- 
Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)¶
- C函数 - PyByteArray_Size()的宏版本。
