@@ -447,6 +447,25 @@ definition with the same method name.
447447 slot. This is helpful because calls to PyCFunctions are optimized more
448448 than wrapper object calls.
449449
450+
451+ .. c :var :: PyTypeObject PyCMethod_Type
452+
453+ The type object corresponding to Python C method objects. This is
454+ available as :class: `types.BuiltinMethodType ` in the Python layer.
455+
456+
457+ .. c :function :: int PyCMethod_Check (PyObject *op)
458+
459+ Return true if *op * is an instance of the :c:type: `PyCMethod_Type ` type
460+ or a subtype of it. This function always succeeds.
461+
462+
463+ .. c :function :: int PyCMethod_CheckExact (PyObject *op)
464+
465+ This is the same as :c:func: `PyCMethod_Check `, but does not account for
466+ subtypes.
467+
468+
450469.. c :function :: PyObject * PyCMethod_New (PyMethodDef *ml, PyObject *self, PyObject *module, PyTypeObject *cls)
451470
452471 Turn *ml * into a Python :term: `callable ` object.
@@ -472,6 +491,24 @@ definition with the same method name.
472491 .. versionadded :: 3.9
473492
474493
494+ .. c :var :: PyTypeObject PyCFunction_Type
495+
496+ The type object corresponding to Python C function objects. This is
497+ available as :class: `types.BuiltinFunctionType ` in the Python layer.
498+
499+
500+ .. c :function :: int PyCFunction_Check (PyObject *op)
501+
502+ Return true if *op * is an instance of the :c:type: `PyCFunction_Type ` type
503+ or a subtype of it. This function always succeeds.
504+
505+
506+ .. c :function :: int PyCFunction_CheckExact (PyObject *op)
507+
508+ This is the same as :c:func: `PyCFunction_Check `, but does not account for
509+ subtypes.
510+
511+
475512.. c :function :: PyObject * PyCFunction_NewEx (PyMethodDef *ml, PyObject *self, PyObject *module)
476513
477514 Equivalent to ``PyCMethod_New(ml, self, module, NULL) ``.
@@ -482,6 +519,62 @@ definition with the same method name.
482519 Equivalent to ``PyCMethod_New(ml, self, NULL, NULL) ``.
483520
484521
522+ .. c :function :: int PyCFunction_GetFlags (PyObject *func)
523+
524+ Get the function's flags on *func * as they were passed to
525+ :c:member: `~PyMethodDef.ml_flags `.
526+
527+ If *func * is not a C function object, this fails with an exception.
528+ *func * must not be ``NULL ``.
529+
530+ This function returns the function's flags on success, and ``-1 `` with an
531+ exception set on failure.
532+
533+
534+ .. c :function :: int PyCFunction_GET_FLAGS (PyObject *func)
535+
536+ This is the same as :c:func: `PyCFunction_GetFlags `, but without error
537+ or type checking.
538+
539+
540+ .. c :function :: PyCFunction PyCFunction_GetFunction (PyObject *func)
541+
542+ Get the function pointer on *func * as it was passed to
543+ :c:member: `~PyMethodDef.ml_meth `.
544+
545+ If *func * is not a C function object, this fails with an exception.
546+ *func * must not be ``NULL ``.
547+
548+ This function returns the function pointer on success, and ``NULL `` with an
549+ exception set on failure.
550+
551+
552+ .. c :function :: int PyCFunction_GET_FUNCTION (PyObject *func)
553+
554+ This is the same as :c:func: `PyCFunction_GetFunction `, but without error
555+ or type checking.
556+
557+
558+ .. c :function :: PyObject *PyCFunction_GetSelf (PyObject *func)
559+
560+ Get the "self" object on *func *. This is the object that would be passed
561+ to the first argument of a :c:type: `PyCFunction `. For C function objects
562+ created through a :c:type: `PyMethodDef ` on a :c:type: `PyModuleDef `, this
563+ is the resulting module object.
564+
565+ If *func * is not a C function object, this fails with an exception.
566+ *func * must not be ``NULL ``.
567+
568+ This function returns a :term: `borrowed reference ` to the "self" object
569+ on success, and ``NULL `` with an exception set on failure.
570+
571+
572+ .. c :function :: PyObject *PyCFunction_GET_SELF (PyObject *func)
573+
574+ This is the same as :c:func: `PyCFunction_GetSelf `, but without error or
575+ type checking.
576+
577+
485578Accessing attributes of extension types
486579---------------------------------------
487580
0 commit comments