@@ -472,6 +472,24 @@ definition with the same method name.
472472 .. versionadded :: 3.9
473473
474474
475+ .. c :var :: PyTypeObject PyCFunction_Type
476+
477+ The type object corresponding to Python C function objects. This is
478+ available as :class: `types.BuiltinFunctionType ` in the Python layer.
479+
480+
481+ .. c :function :: int PyCFunction_Check (PyObject *f)
482+
483+ Return true if *f * is an instance of the :c:type: `PyCFunction_Type ` type
484+ or a subtype of it. This function always succeeds.
485+
486+
487+ .. c :function :: int PyCFunction_CheckExact (PyObject *f)
488+
489+ This is the same as :c:func: `PyCFunction_Check `, but does not account for
490+ subtypes.
491+
492+
475493.. c :function :: PyObject * PyCFunction_NewEx (PyMethodDef *ml, PyObject *self, PyObject *module)
476494
477495 Equivalent to ``PyCMethod_New(ml, self, module, NULL) ``.
@@ -482,6 +500,52 @@ definition with the same method name.
482500 Equivalent to ``PyCMethod_New(ml, self, NULL, NULL) ``.
483501
484502
503+ .. c :function :: int PyCFunction_GetFlags (PyObject *func)
504+
505+ Get the function flags on *func * as they were passed to
506+ :c:member: `~PyMethodDef.ml_flags `.
507+
508+ This function returns the function's flags on success, and ``-1 `` with an
509+ exception set on failure.
510+
511+
512+ .. c :function :: int PyCFunction_GET_FLAGS (PyObject *func)
513+
514+ This is the same as :c:func: `PyCFunction_GetFlags `, but without error
515+ checking.
516+
517+
518+ .. c :function :: PyCFunction PyCFunction_GetFunction (PyObject *func)
519+
520+ Get the function pointer on *func * as it was passed to
521+ :c:member: `~PyMethodDef.ml_meth `.
522+
523+ This function returns the function pointer on success, and ``NULL `` with an
524+ exception set on failure.
525+
526+
527+ .. c :function :: int PyCFunction_GET_FUNCTION (PyObject *func)
528+
529+ This is the same as :c:func: `PyCFunction_GetFunction `, but without error
530+ checking.
531+
532+
533+ .. c :function :: PyObject *PyCFunction_GetSelf (PyObject *func)
534+
535+ Get the "self" object on *func *. This is the object that would be passed
536+ to the first argument of a :c:type: `PyCFunction `. In modules, this is the
537+ module object.
538+
539+ This function returns a :term: `borrowed reference ` to the "self" object
540+ on success, and ``NULL `` with an exception set on failure.
541+
542+
543+ .. c :function :: PyObject *PyCFunction_GET_SELF (PyObject *func)
544+
545+ This is the same as :c:func: `PyCFunction_GetSelf `, but without error
546+ checking.
547+
548+
485549Accessing attributes of extension types
486550---------------------------------------
487551
0 commit comments