Make partial and partialmethod exposed in capi

I think that both partial and partialmethod can be realized in pure c. This idea is to expose them in capi:

  • bool PyPartial_Check(PyObject* obj): return whether the object is an instance of partial
  • bool PyPartialMethod_Check(PyObject* obj): return whether the object is an instance of partialmethod
  • PyObject* PyPartial_GetFunc(PyObject* obj): return the func attribute of a partial object (need check before)
  • PyObject* PyPartialMethod_GetFunc(PyObject* obj): return the func attribute of a partialmethod object (need check before)
  • PyObject* PyPartial_GetArgs(PyObject* obj): return the args attribute of a partial object (need check before)
  • PyObject* PyPartialMethod_GetArgs(PyObject* obj): return the args attribute of a partialmethod object (need check before)
  • PyObject* PyPartial_GetKwargs(PyObject* obj): return the kwargs attribute of a partial object (need check before)
  • PyObject* PyPartialMethod_GetKwargs(PyObject* obj): return the kwargs attribute of a partialmethod object (need check before)

If they are exposed in capi user don’t need to import the hole functools and the checking and getting can be faster.