'y#' str(accept={robuffer}, zeroes=True) 'y*' Py_buffer 'Z' Py_UNICODE(accept={str, NoneType}) 'Z#' Py_UNICODE(accept={str, NoneType}, zeroes=True) 'z' str(accept={str, NoneType}) 'z#' str(accept={str, NoneType}, zeroes=True) 'z*' Py_buffer(accept={buffer, str, NoneType}) Table 1 – continued from previous page /*[clinic input] pickle.Pickler.dump obj: object The object to be pickled. / Write a pickled representation of obj to the open file. [clinic start generated code]*/ As an example, here’s our sample$_{pickle.Pickler.dump}$ using the proper converter: One advantage of real converters is that they’re more flexible than legacy converters. For example, the unsigned_int converter (and all the$_{unsigned_}$converters) can be specified without$_{bitwise=True}$. Their default behavior performs range checking on the value, and they won’t accept negative numbers. You just can’t do that with a legacy converter! Argument Clinic will show you all the converters it has available. For each converter it’ll show you all the pa- rameters it accepts, along with the default value for each parameter. Just run Tools/clinic/clinic.py --converters to see the full list. When using the$_{Py_buffer}$converter (or the$_{'s*'}$ , 'w*' , '*y' , or$_{'z*'}$ legacy converters), you must not call$_{PyBuffer_Release()}$ on the provided buffer. Argument Clinic generates code that does it for you (in the parsing function). Remember those format units you skipped for your first time because they were advanced? Here’s how to handle those too. The trick is, all those format units take arguments—either conversion functions, or types, or strings specifying an encoding. (But “legacy converters” don’t support arguments. That’s why we skipped them for your first function.) The argument you specified to the format unit is now an argument to the converter; this argument is either$_{converter}$ (for$_{O&}$),$_{subclass_of}$ (for$_{O!}$), or$_{encoding}$(for all the format units that start with$_{e}$). When using$_{subclass_of}$ , you may also want to use the other custom argument for$_{object()}$ : $_{type}$, which lets you set the type actually used for the parameter. For example, if you want to ensure that the object is a subclass of$_{PyUnicode_Type}$, you probably want to use the converter$_{object(type='PyUnicodeObject *',}$ subclass_of='&PyUnicode_Type') . One possible problem with using Argument Clinic: it takes away some possible flexibility for the format units starting with$_{e}$. When writing a$_{PyArg_Parse}$ call by hand, you could theoretically decide at runtime what encoding string to pass in to$_{PyArg_ParseTuple()}$ . But now this string must be hard-coded at Argument-Clinic-preprocessing- time. This limitation is deliberate; it made supporting this format unit much easier, and may allow for future opti- mizations. This restriction doesn’t seem unreasonable; CPython itself always passes in static hard-coded encoding strings for parameters whose format units start with$_{e}$. 13 4.7 Advanced converters 4.6 Py_buffer