-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-141004: Document missing PyCFunction* and PyCMethod* APIs
#141253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
1f8d65e
a0cf7ec
4ac3cf6
e059d66
ed05eba
7bf86c7
0067054
b9774f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -447,6 +447,25 @@ definition with the same method name. | |
| slot. This is helpful because calls to PyCFunctions are optimized more | ||
| than wrapper object calls. | ||
|
|
||
|
|
||
| .. c:var:: PyTypeObject PyCMethod_Type | ||
|
|
||
| The type object corresponding to Python C method objects. This is | ||
| available as :class:`types.BuiltinMethodType` in the Python layer. | ||
|
|
||
|
|
||
| .. c:function:: int PyCMethod_Check(PyObject *f) | ||
|
|
||
| Return true if *f* is an instance of the :c:type:`PyCMethod_Type` type | ||
| or a subtype of it. This function always succeeds. | ||
|
|
||
|
|
||
| .. c:function:: int PyCMethod_CheckExact(PyObject *f) | ||
|
|
||
| This is the same as :c:func:`PyCMethod_Check`, but does not account for | ||
| subtypes. | ||
|
|
||
|
|
||
| .. c:function:: PyObject * PyCMethod_New(PyMethodDef *ml, PyObject *self, PyObject *module, PyTypeObject *cls) | ||
|
|
||
| Turn *ml* into a Python :term:`callable` object. | ||
|
|
@@ -472,6 +491,24 @@ definition with the same method name. | |
| .. versionadded:: 3.9 | ||
|
|
||
|
|
||
| .. c:var:: PyTypeObject PyCFunction_Type | ||
|
|
||
| The type object corresponding to Python C function objects. This is | ||
| available as :class:`types.BuiltinFunctionType` in the Python layer. | ||
|
|
||
|
|
||
| .. c:function:: int PyCFunction_Check(PyObject *f) | ||
|
||
|
|
||
| Return true if *f* is an instance of the :c:type:`PyCFunction_Type` type | ||
picnixz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| or a subtype of it. This function always succeeds. | ||
picnixz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| .. c:function:: int PyCFunction_CheckExact(PyObject *f) | ||
|
|
||
| This is the same as :c:func:`PyCFunction_Check`, but does not account for | ||
| subtypes. | ||
|
|
||
|
|
||
| .. c:function:: PyObject * PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) | ||
|
|
||
| Equivalent to ``PyCMethod_New(ml, self, module, NULL)``. | ||
|
|
@@ -482,6 +519,52 @@ definition with the same method name. | |
| Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``. | ||
|
|
||
|
|
||
| .. c:function:: int PyCFunction_GetFlags(PyObject *func) | ||
|
|
||
| Get the function flags on *func* as they were passed to | ||
picnixz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ZeroIntensity marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| :c:member:`~PyMethodDef.ml_flags`. | ||
|
|
||
| This function returns the function's flags on success, and ``-1`` with an | ||
| exception set on failure. | ||
|
|
||
|
|
||
| .. c:function:: int PyCFunction_GET_FLAGS(PyObject *func) | ||
|
|
||
| This is the same as :c:func:`PyCFunction_GetFlags`, but without error | ||
| checking. | ||
|
|
||
|
|
||
| .. c:function:: PyCFunction PyCFunction_GetFunction(PyObject *func) | ||
|
|
||
| Get the function pointer on *func* as it was passed to | ||
picnixz marked this conversation as resolved.
Show resolved
Hide resolved
picnixz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| :c:member:`~PyMethodDef.ml_meth`. | ||
|
|
||
| This function returns the function pointer on success, and ``NULL`` with an | ||
| exception set on failure. | ||
|
|
||
|
|
||
| .. c:function:: int PyCFunction_GET_FUNCTION(PyObject *func) | ||
|
|
||
| This is the same as :c:func:`PyCFunction_GetFunction`, but without error | ||
| checking. | ||
|
|
||
|
|
||
| .. c:function:: PyObject *PyCFunction_GetSelf(PyObject *func) | ||
|
|
||
| Get the "self" object on *func*. This is the object that would be passed | ||
picnixz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| to the first argument of a :c:type:`PyCFunction`. In modules, this is the | ||
| module object. | ||
|
||
|
|
||
| This function returns a :term:`borrowed reference` to the "self" object | ||
| on success, and ``NULL`` with an exception set on failure. | ||
|
|
||
|
|
||
| .. c:function:: PyObject *PyCFunction_GET_SELF(PyObject *func) | ||
|
|
||
| This is the same as :c:func:`PyCFunction_GetSelf`, but without error | ||
| checking. | ||
|
|
||
|
|
||
| Accessing attributes of extension types | ||
| --------------------------------------- | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.