table continued format python type argument type "es#string or bytes "etstring or null-terminated bytes "et#string or bytes " #" " #" *read-only buffer read-write buffer read-write buffer read-write buffer const char *encchar **rint *len const char *encchar **rint *len const char *encchar **rint *len char **rint *len char ** char **rint *len py_buffer * string handling presents special problem for extensions because the char datatype is used for many different purposes for instanceit might refer to texta single characteror buffer of raw binary data there is also the issue of what to do with embedded null characters ('\ 'that uses to signal the end of text strings in table the conversion codes of " "" "" ""es"and "etshould be used if you are passing text for these codespython assumes that the input text does not contain any embedded nulls--if soa typeerror exception is raised howeverthe resulting string in can be safely assumed to be null-terminated in python both -bit and unicode strings can be passedbut in python all conversions except for "etrequire the python str type and do not work with bytes when unicode strings are passed to cthey are always encoded using the default unicode encoding used by the interpreter (usually utf- the one exception is the "uconversion code that returns string using python' internal unicode representation this is an array of py_unicode values where unicode characters are typically represented by the wchar_t type in the "esand "etcodes allow you to specify an alternative encoding for the text for theseyou supply an encoding name such as 'utf- or 'iso- - 'and the text will be encoded into buffer and returned in that format the "etcode differs from "esin that if python byte-string is givenit is assumed to have already been encoded and is passed through unmodified one caution with "esand "etconversions is that they dynamically allocate memory for the result and require the user to explicitly release it using pymem_free(thuscode that uses these conversions should look similar to thispyobject *py_wrapper(pyobject *selfpyobject *argschar *bufferif (!pyarg_parsetuple(args,"es","utf- ",&buffer)return null/do something */cleanup and return the result *pymem_free(buffer)return resultf lib fl ff