#include "Python.h"
#include "pycore_capsule.h"
#include "pycore_gc.h"
#include "pycore_object.h"
PyCapsule;
static int
_is_legal_capsule(PyObject *op, const char *invalid_capsule)
{ … }
#define is_legal_capsule(capsule, name) …
static int
name_matches(const char *name1, const char *name2) { … }
PyObject *
PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor)
{ … }
int
PyCapsule_IsValid(PyObject *op, const char *name)
{ … }
void *
PyCapsule_GetPointer(PyObject *op, const char *name)
{ … }
const char *
PyCapsule_GetName(PyObject *op)
{ … }
PyCapsule_Destructor
PyCapsule_GetDestructor(PyObject *op)
{ … }
void *
PyCapsule_GetContext(PyObject *op)
{ … }
int
PyCapsule_SetPointer(PyObject *op, void *pointer)
{ … }
int
PyCapsule_SetName(PyObject *op, const char *name)
{ … }
int
PyCapsule_SetDestructor(PyObject *op, PyCapsule_Destructor destructor)
{ … }
int
PyCapsule_SetContext(PyObject *op, void *context)
{ … }
int
_PyCapsule_SetTraverse(PyObject *op, traverseproc traverse_func, inquiry clear_func)
{ … }
void *
PyCapsule_Import(const char *name, int no_block)
{ … }
static void
capsule_dealloc(PyObject *op)
{ … }
static PyObject *
capsule_repr(PyObject *o)
{ … }
static int
capsule_traverse(PyCapsule *capsule, visitproc visit, void *arg)
{ … }
static int
capsule_clear(PyCapsule *capsule)
{ … }
PyDoc_STRVAR(PyCapsule_Type__doc__,
"Capsule objects let you wrap a C \"void *\" pointer in a Python\n\
object. They're a way of passing data through the Python interpreter\n\
without creating your own custom type.\n\
\n\
Capsules are used for communication between extension modules.\n\
They provide a way for an extension module to export a C interface\n\
to other extension modules, so that extension modules can use the\n\
Python import mechanism to link to one another.\n\
");
PyTypeObject PyCapsule_Type = …;