extending and embedding python for handling text or binary datause the " #"" #"" #""es#"or "et#codes these conversions work exactly the same as before except that they additionally return length because of thisthe restriction on embedded null characters is lifted in additionthese conversions add support for byte strings and any other objects that support something known as the buffer interface the buffer interface is means by which python object can expose raw binary buffer representing its contents typicallyyou find it on stringsbytesand arrays ( the arrays created in the array module support itin this caseif an object provides readable buffer interfacea pointer to the buffer and its size is returned finallyif non-null pointer and length are given to the "es#and "et#conversionsit is assumed that these represent pre-allocated buffer into which the result of the encoding can be placed in this casethe interpreter does not allocate new memory for the result and you don' have to call pymem_free(the conversion codes of " *and " *are similar to " #and " #except that they populate py_buffer structure with information about the received data more information about this can be found in pep- but this structure minimally has attributes char *bufint lenand int itemsize that point to the bufferthe buffer length (in bytes)and the size of items held in the buffer in additionthe interpreter places lock on the buffer that prevents it from being changed by other threads as long as it is held by extension code this allows the extension to work with the buffer contents independentlypossibly in different thread than the interpreter it is up to the user to call pybuffer_release(on the buffer after all processing is complete the conversion codes of " #"" "" #"and " *are just like the "sfamily of codes except that they only accept objects implementing the buffer interface " #requires the buffer to be readable the "wcode requires the buffer to be both readable and writable python object supporting writable buffer is assumed to be mutable thusit is legal for extension to overwrite or modify the buffer contents the conversion codes of " "" #"and " *are just like the "sfamily of codes except that they only accept byte strings use these to write functions that must only take bytesnot unicode strings the "ycode only accepts byte strings that do not contain embedded null characters table lists conversion codes that are used to accept arbitrary python objects as input and to leave the result as type pyobject these are sometimes used for extensions that need to work with python objects that are more complicated than simple numbers or strings--for exampleif you needed extension function to accept an instance of python class or dictionary table python object conversions and associated data types for pyarg_parseformat python type type "oany any any string unicode pyobject ** " !" &" "upytypeobject *typepyobject ** int (*converter)(pyobject *void *)void * pyobject ** pyobject ** lib fl ff