Mercurial > cpython-lru_cache-weakref
annotate Include/pycapsule.h @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | e18d38201280 |
| children |
| rev | line source |
|---|---|
|
59998
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
1 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
2 /* Capsule objects let you wrap a C "void *" pointer in a Python |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
3 object. They're a way of passing data through the Python interpreter |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
4 without creating your own custom type. |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
5 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
6 Capsules are used for communication between extension modules. |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
7 They provide a way for an extension module to export a C interface |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
8 to other extension modules, so that extension modules can use the |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
9 Python import mechanism to link to one another. |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
10 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
11 For more information, please see "c-api/capsule.html" in the |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
12 documentation. |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
13 */ |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
14 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
15 #ifndef Py_CAPSULE_H |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
16 #define Py_CAPSULE_H |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
17 #ifdef __cplusplus |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
18 extern "C" { |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
19 #endif |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
20 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
21 PyAPI_DATA(PyTypeObject) PyCapsule_Type; |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
22 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
23 typedef void (*PyCapsule_Destructor)(PyObject *); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
24 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
25 #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
26 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
27 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
28 PyAPI_FUNC(PyObject *) PyCapsule_New( |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
29 void *pointer, |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
30 const char *name, |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
31 PyCapsule_Destructor destructor); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
32 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
33 PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
34 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
35 PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
36 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
37 PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
38 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
39 PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
40 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
41 PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
42 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
43 PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
44 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
45 PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
46 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
47 PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
48 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
49 PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
50 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
51 PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block); |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
52 |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
53 #ifdef __cplusplus |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
54 } |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
55 #endif |
|
d11fbc796499
Backported PyCapsule from 3.1, and converted most uses of
Larry Hastings <larry@hastings.org>
parents:
diff
changeset
|
56 #endif /* !Py_CAPSULE_H */ |
