annotate test/include/python2.7/cobject.h @ 3:7d1a9a91b989 draft

planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
author yating-l
date Thu, 18 May 2017 18:37:28 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
1 /*
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
2 CObjects are marked Pending Deprecation as of Python 2.7.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
3 The full schedule for 2.x is as follows:
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
4 - CObjects are marked Pending Deprecation in Python 2.7.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
5 - CObjects will be marked Deprecated in Python 2.8
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
6 (if there is one).
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
7 - CObjects will be removed in Python 2.9 (if there is one).
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
8
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
9 Additionally, for the Python 3.x series:
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
10 - CObjects were marked Deprecated in Python 3.1.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
11 - CObjects will be removed in Python 3.2.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
12
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
13 You should switch all use of CObjects to capsules. Capsules
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
14 have a safer and more consistent API. For more information,
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
15 see Include/pycapsule.h, or read the "Capsules" topic in
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
16 the "Python/C API Reference Manual".
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
17
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
18 Python 2.7 no longer uses CObjects itself; all objects which
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
19 were formerly CObjects are now capsules. Note that this change
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
20 does not by itself break binary compatibility with extensions
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
21 built for previous versions of Python--PyCObject_AsVoidPtr()
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
22 has been changed to also understand capsules.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
23
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
24 */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
25
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
26 /* original file header comment follows: */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
27
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
28 /* C objects to be exported from one extension module to another.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
29
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
30 C objects are used for communication between extension modules.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
31 They provide a way for an extension module to export a C interface
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
32 to other extension modules, so that extension modules can use the
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
33 Python import mechanism to link to one another.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
34
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
35 */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
36
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
37 #ifndef Py_COBJECT_H
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
38 #define Py_COBJECT_H
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
39 #ifdef __cplusplus
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
40 extern "C" {
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
41 #endif
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
42
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
43 PyAPI_DATA(PyTypeObject) PyCObject_Type;
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
44
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
45 #define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type)
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
46
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
47 /* Create a PyCObject from a pointer to a C object and an optional
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
48 destructor function. If the second argument is non-null, then it
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
49 will be called with the first argument if and when the PyCObject is
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
50 destroyed.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
51
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
52 */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
53 PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr(
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
54 void *cobj, void (*destruct)(void*));
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
55
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
56
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
57 /* Create a PyCObject from a pointer to a C object, a description object,
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
58 and an optional destructor function. If the third argument is non-null,
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
59 then it will be called with the first and second arguments if and when
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
60 the PyCObject is destroyed.
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
61 */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
62 PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc(
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
63 void *cobj, void *desc, void (*destruct)(void*,void*));
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
64
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
65 /* Retrieve a pointer to a C object from a PyCObject. */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
66 PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *);
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
67
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
68 /* Retrieve a pointer to a description object from a PyCObject. */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
69 PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *);
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
70
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
71 /* Import a pointer to a C object from a module using a PyCObject. */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
72 PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name);
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
73
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
74 /* Modify a C object. Fails (==0) if object has a destructor. */
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
75 PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj);
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
76
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
77
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
78 typedef struct {
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
79 PyObject_HEAD
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
80 void *cobject;
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
81 void *desc;
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
82 void (*destructor)(void *);
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
83 } PyCObject;
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
84
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
85
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
86 #ifdef __cplusplus
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
87 }
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
88 #endif
7d1a9a91b989 planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit d583ac16a6c6942730ea536eb59cc37941816030-dirty
yating-l
parents:
diff changeset
89 #endif /* !Py_COBJECT_H */