annotate Objects/cobject.c @ 65035:87f4b32905df 2.7

Cosmetic fix to use print function.
author Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
date Fri, 01 Oct 2010 10:48:47 +0000
parents 57f4c99082df
children 4ee682fbec30
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
1
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 /* Wrap void* pointers to be passed between C modules */
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 #include "Python.h"
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
5
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
6
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 /* Declarations for objects of type PyCObject */
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
13447
a89f7f268de4 Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents: 13256
diff changeset
9 typedef void (*destructor1)(void *);
a89f7f268de4 Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents: 13256
diff changeset
10 typedef void (*destructor2)(void *, void*);
6509
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
11
60157
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
12 static int cobject_deprecation_warning(void)
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
13 {
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
14 return PyErr_WarnEx(PyExc_PendingDeprecationWarning,
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
15 "The CObject type is marked Pending Deprecation in Python 2.7. "
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
16 "Please use capsule objects instead.", 1);
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
17 }
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
18
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
19
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 PyObject *
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
21 PyCObject_FromVoidPtr(void *cobj, void (*destr)(void *))
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 {
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
23 PyCObject *self;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
24
60157
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
25 if (cobject_deprecation_warning()) {
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
26 return NULL;
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
27 }
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
28
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
29 self = PyObject_NEW(PyCObject, &PyCObject_Type);
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
30 if (self == NULL)
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
31 return NULL;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
32 self->cobject=cobj;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
33 self->destructor=destr;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
34 self->desc=NULL;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
35
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
36 return (PyObject *)self;
6509
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
37 }
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
38
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
39 PyObject *
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
40 PyCObject_FromVoidPtrAndDesc(void *cobj, void *desc,
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
41 void (*destr)(void *, void *))
6509
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
42 {
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
43 PyCObject *self;
6509
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
44
60157
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
45 if (cobject_deprecation_warning()) {
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
46 return NULL;
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
47 }
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
48
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
49 if (!desc) {
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
50 PyErr_SetString(PyExc_TypeError,
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
51 "PyCObject_FromVoidPtrAndDesc called with null"
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
52 " description");
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
53 return NULL;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
54 }
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
55 self = PyObject_NEW(PyCObject, &PyCObject_Type);
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
56 if (self == NULL)
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
57 return NULL;
29814
cb3ce7cec261 Add whitespace.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23832
diff changeset
58 self->cobject = cobj;
cb3ce7cec261 Add whitespace.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23832
diff changeset
59 self->destructor = (destructor1)destr;
cb3ce7cec261 Add whitespace.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23832
diff changeset
60 self->desc = desc;
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
61
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
62 return (PyObject *)self;
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 }
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
64
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
65 void *
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
66 PyCObject_AsVoidPtr(PyObject *self)
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
67 {
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
68 if (self) {
60157
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
69 if (PyCapsule_CheckExact(self)) {
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
70 const char *name = PyCapsule_GetName(self);
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
71 return (void *)PyCapsule_GetPointer(self, name);
57f4c99082df Capsule-related changes:
Larry Hastings <larry@hastings.org>
parents: 48889
diff changeset
72 }
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
73 if (self->ob_type == &PyCObject_Type)
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
74 return ((PyCObject *)self)->cobject;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
75 PyErr_SetString(PyExc_TypeError,
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
76 "PyCObject_AsVoidPtr with non-C-object");
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
77 }
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
78 if (!PyErr_Occurred())
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
79 PyErr_SetString(PyExc_TypeError,
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
80 "PyCObject_AsVoidPtr called with null pointer");
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
81 return NULL;
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
82 }
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
83
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
84 void *
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
85 PyCObject_GetDesc(PyObject *self)
6509
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
86 {
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
87 if (self) {
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
88 if (self->ob_type == &PyCObject_Type)
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
89 return ((PyCObject *)self)->desc;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
90 PyErr_SetString(PyExc_TypeError,
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
91 "PyCObject_GetDesc with non-C-object");
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
92 }
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
93 if (!PyErr_Occurred())
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
94 PyErr_SetString(PyExc_TypeError,
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
95 "PyCObject_GetDesc called with null pointer");
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
96 return NULL;
6509
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
97 }
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
98
f022bbd12338 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
Guido van Rossum <guido@python.org>
parents: 5115
diff changeset
99 void *
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
100 PyCObject_Import(char *module_name, char *name)
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
101 {
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
102 PyObject *m, *c;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
103 void *r = NULL;
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
104
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
105 if ((m = PyImport_ImportModule(module_name))) {
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
106 if ((c = PyObject_GetAttrString(m,name))) {
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
107 r = PyCObject_AsVoidPtr(c);
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
108 Py_DECREF(c);
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
109 }
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
110 Py_DECREF(m);
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
111 }
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
112 return r;
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
113 }
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
114
30716
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
115 int
36394
74a598964c96 Fix SF #1412837, compile failed with Watcom compiler
Neal Norwitz <nnorwitz@gmail.com>
parents: 30716
diff changeset
116 PyCObject_SetVoidPtr(PyObject *self, void *cobj)
30716
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
117 {
36394
74a598964c96 Fix SF #1412837, compile failed with Watcom compiler
Neal Norwitz <nnorwitz@gmail.com>
parents: 30716
diff changeset
118 PyCObject* cself = (PyCObject*)self;
74a598964c96 Fix SF #1412837, compile failed with Watcom compiler
Neal Norwitz <nnorwitz@gmail.com>
parents: 30716
diff changeset
119 if (cself == NULL || !PyCObject_Check(cself) ||
74a598964c96 Fix SF #1412837, compile failed with Watcom compiler
Neal Norwitz <nnorwitz@gmail.com>
parents: 30716
diff changeset
120 cself->destructor != NULL) {
30716
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
121 PyErr_SetString(PyExc_TypeError,
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
122 "Invalid call to PyCObject_SetVoidPtr");
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
123 return 0;
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
124 }
36394
74a598964c96 Fix SF #1412837, compile failed with Watcom compiler
Neal Norwitz <nnorwitz@gmail.com>
parents: 30716
diff changeset
125 cself->cobject = cobj;
30716
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
126 return 1;
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
127 }
07a0a0726649 Make CObjects mutable. Fixes #477441.
Martin v. Löwis <martin@v.loewis.de>
parents: 29814
diff changeset
128
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
129 static void
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
130 PyCObject_dealloc(PyCObject *self)
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
131 {
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
132 if (self->destructor) {
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
133 if(self->desc)
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
134 ((destructor2)(self->destructor))(self->cobject, self->desc);
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
135 else
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
136 (self->destructor)(self->cobject);
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
137 }
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
138 PyObject_DEL(self);
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
139 }
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
140
5033
5b7b703dabfa Added PyCObject_Import.
Guido van Rossum <guido@python.org>
parents: 4584
diff changeset
141
23832
ed1ba37a46b7 Patch #568124: Add doc string macros.
Martin v. Löwis <martin@v.loewis.de>
parents: 14375
diff changeset
142 PyDoc_STRVAR(PyCObject_Type__doc__,
3910
9cf11af3628c Allow compilation by K&R C compiler.
Guido van Rossum <guido@python.org>
parents: 3315
diff changeset
143 "C objects to be exported from one extension module to another\n\
9cf11af3628c Allow compilation by K&R C compiler.
Guido van Rossum <guido@python.org>
parents: 3315
diff changeset
144 \n\
9cf11af3628c Allow compilation by K&R C compiler.
Guido van Rossum <guido@python.org>
parents: 3315
diff changeset
145 C objects are used for communication between extension modules. They\n\
9cf11af3628c Allow compilation by K&R C compiler.
Guido van Rossum <guido@python.org>
parents: 3315
diff changeset
146 provide a way for an extension module to export a C interface to other\n\
9cf11af3628c Allow compilation by K&R C compiler.
Guido van Rossum <guido@python.org>
parents: 3315
diff changeset
147 extension modules, so that extension modules can use the Python import\n\
23832
ed1ba37a46b7 Patch #568124: Add doc string macros.
Martin v. Löwis <martin@v.loewis.de>
parents: 14375
diff changeset
148 mechanism to link to one another.");
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
149
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
150 PyTypeObject PyCObject_Type = {
42334
e70cdce0e8b2 Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents: 37304
diff changeset
151 PyVarObject_HEAD_INIT(&PyType_Type, 0)
37304
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
152 "PyCObject", /*tp_name*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
153 sizeof(PyCObject), /*tp_basicsize*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
154 0, /*tp_itemsize*/
13450
4ad26968662b ANSI-fication of the source.
Fred Drake <fdrake@acm.org>
parents: 13447
diff changeset
155 /* methods */
37304
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
156 (destructor)PyCObject_dealloc, /*tp_dealloc*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
157 0, /*tp_print*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
158 0, /*tp_getattr*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
159 0, /*tp_setattr*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
160 0, /*tp_compare*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
161 0, /*tp_repr*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
162 0, /*tp_as_number*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
163 0, /*tp_as_sequence*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
164 0, /*tp_as_mapping*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
165 0, /*tp_hash*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
166 0, /*tp_call*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
167 0, /*tp_str*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
168 0, /*tp_getattro*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
169 0, /*tp_setattro*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
170 0, /*tp_as_buffer*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
171 0, /*tp_flags*/
79a0f080f898 Remove unnecessary casts in type object initializers.
Georg Brandl <georg@python.org>
parents: 36394
diff changeset
172 PyCObject_Type__doc__ /*tp_doc*/
3315
44f48aaca8bf opaque C object a la Jim Fulton
Guido van Rossum <guido@python.org>
parents:
diff changeset
173 };