Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

pycapsule.h 1.7 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  1. /* Capsule objects let you wrap a C "void *" pointer in a Python
  2. object. They're a way of passing data through the Python interpreter
  3. without creating your own custom type.
  4. Capsules are used for communication between extension modules.
  5. They provide a way for an extension module to export a C interface
  6. to other extension modules, so that extension modules can use the
  7. Python import mechanism to link to one another.
  8. For more information, please see "c-api/capsule.html" in the
  9. documentation.
  10. */
  11. #ifndef Py_CAPSULE_H
  12. #define Py_CAPSULE_H
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. PyAPI_DATA(PyTypeObject) PyCapsule_Type;
  17. typedef void (*PyCapsule_Destructor)(PyObject *);
  18. #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type)
  19. PyAPI_FUNC(PyObject *) PyCapsule_New(
  20. void *pointer,
  21. const char *name,
  22. PyCapsule_Destructor destructor);
  23. PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name);
  24. PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule);
  25. PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule);
  26. PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule);
  27. PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name);
  28. PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer);
  29. PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor);
  30. PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name);
  31. PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context);
  32. PyAPI_FUNC(void *) PyCapsule_Import(
  33. const char *name, /* UTF-8 encoded string */
  34. int no_block);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif /* !Py_CAPSULE_H */
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...