(continued from previous page) 

/ Write a pickled representation of obj to the open file. [clinic start generated code]*/ PyDoc_STRVAR(__pickle_Pickler_dump__doc__, "Write a pickled representation of obj to the open file. 
 " " 
 " ... static PyObject * _pickle_Pickler_dump_impl(PicklerObject *self, PyObject*obj) /*[clinic end generated code: ␣ ↪ → checksum=3bd30745bf206a48f8b576a1da3d90f55a0a4187]*/ { /* Check whether the Pickler was initialized correctly (issue3664). Developers often forget to call __init__() in their subclasses, which would trigger a segfault without this check. */ if (self ->write ==NULL ) { PyErr_Format(PicklingError, "Pickler.__init__() was not called by %s.__init__() ", Py_TYPE(self) ->tp_name); return NULL ; } if (_Pickler_ClearBuffer(self) <0) return NULL ; ... 

15. Remember the macro with the$_{PyMethodDef}$ structure for this function? Find the existing$_{PyMethodDef}$ structure for this function and replace it with a reference to the macro. (If the builtin is at module scope, this will probably be very near the end of the file; if the builtin is a class method, this will probably be below but relatively near to the implementation.) 

Note that the body of the macro contains a trailing comma. So when you replace the existing static PyMethodDef structure with the macro, don’t add a comma to the end. 

Sample: 

static structPyMethodDef Pickler_methods[] ={ __PICKLE_PICKLER_DUMP_METHODDEF __PICKLE_PICKLER_CLEAR_MEMO_METHODDEF { NULL ,NULL } /* sentinel */ }; 

16. Compile, then run the relevant portions of the regression-test suite. This change should not introduce any new compile-time warnings or errors, and there should be no externally-visible change to Python’s behavior. 

Well, except for one difference: inspect.signature() run on your function should now provide a valid signature! 

Congratulations, you’ve ported your first function to work with Argument Clinic! 

