gh-94808: cover PyFunction_GetDefaults and PyFunction_SetDefaults by sobolevn · Pull Request #98449 · python/cpython (original) (raw)

There's a difference with func_get_defaults:

static PyObject * func_get_defaults(PyFunctionObject *op, void *Py_UNUSED(ignored)) { if (PySys_Audit("object.getattr", "Os", op, "defaults") < 0) { return NULL; } if (op->func_defaults == NULL) { Py_RETURN_NONE; } Py_INCREF(op->func_defaults); return op->func_defaults; }