@@ -143,54 +143,13 @@ extern "C"
143
143
144
144
static PyTypeObject static_data_object = {
145
145
PyVarObject_HEAD_INIT (NULL , 0 )
146
- const_cast <char *>(" Boost.Python.StaticProperty" ),
147
- sizeof (propertyobject),
148
- 0 ,
149
- 0 , /* tp_dealloc */
150
- 0 , /* tp_print */
151
- 0 , /* tp_getattr */
152
- 0 , /* tp_setattr */
153
- 0 , /* tp_compare */
154
- 0 , /* tp_repr */
155
- 0 , /* tp_as_number */
156
- 0 , /* tp_as_sequence */
157
- 0 , /* tp_as_mapping */
158
- 0 , /* tp_hash */
159
- 0 , /* tp_call */
160
- 0 , /* tp_str */
161
- 0 , /* tp_getattro */
162
- 0 , /* tp_setattro */
163
- 0 , /* tp_as_buffer */
164
- Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC
146
+ .tp_name = const_cast <char *>(" Boost.Python.StaticProperty" ),
147
+ .tp_basicsize = sizeof (propertyobject),
148
+ .tp_flags = Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC
165
149
| Py_TPFLAGS_BASETYPE, /* tp_flags */
166
- 0 , /* tp_doc */
167
- 0 , /* tp_traverse */
168
- 0 , /* tp_clear */
169
- 0 , /* tp_richcompare */
170
- 0 , /* tp_weaklistoffset */
171
- 0 , /* tp_iter */
172
- 0 , /* tp_iternext */
173
- 0 , /* tp_methods */
174
- 0 , /* tp_members */
175
- 0 , /* tp_getset */
176
- 0 , // &PyProperty_Type, /* tp_base */
177
- 0 , /* tp_dict */
178
- static_data_descr_get, /* tp_descr_get */
179
- static_data_descr_set, /* tp_descr_set */
180
- 0 , /* tp_dictoffset */
181
- property_init, /* tp_init */
182
- 0 , /* tp_alloc */
183
- 0 , // filled in with type_new /* tp_new */
184
- 0 , // filled in with __PyObject_GC_Del /* tp_free */
185
- 0 , /* tp_is_gc */
186
- 0 , /* tp_bases */
187
- 0 , /* tp_mro */
188
- 0 , /* tp_cache */
189
- 0 , /* tp_subclasses */
190
- 0 , /* tp_weaklist */
191
- #if PYTHON_API_VERSION >= 1012
192
- 0 /* tp_del */
193
- #endif
150
+ .tp_descr_get = static_data_descr_get,
151
+ .tp_descr_set = static_data_descr_set,
152
+ .tp_init = property_init,
194
153
};
195
154
196
155
namespace objects
@@ -249,54 +208,12 @@ extern "C"
249
208
250
209
static PyTypeObject class_metatype_object = {
251
210
PyVarObject_HEAD_INIT (NULL , 0 )
252
- const_cast <char *>(" Boost.Python.class" ),
253
- PyType_Type.tp_basicsize ,
254
- 0 ,
255
- 0 , /* tp_dealloc */
256
- 0 , /* tp_print */
257
- 0 , /* tp_getattr */
258
- 0 , /* tp_setattr */
259
- 0 , /* tp_compare */
260
- 0 , /* tp_repr */
261
- 0 , /* tp_as_number */
262
- 0 , /* tp_as_sequence */
263
- 0 , /* tp_as_mapping */
264
- 0 , /* tp_hash */
265
- 0 , /* tp_call */
266
- 0 , /* tp_str */
267
- 0 , /* tp_getattro */
268
- class_setattro, /* tp_setattro */
269
- 0 , /* tp_as_buffer */
270
- Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC
211
+ .tp_name = const_cast <char *>(" Boost.Python.class" ),
212
+ .tp_basicsize = PyType_Type.tp_basicsize ,
213
+ .tp_setattro = class_setattro,
214
+ .tp_flags = Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC
271
215
| Py_TPFLAGS_BASETYPE, /* tp_flags */
272
- 0 , /* tp_doc */
273
- 0 , /* tp_traverse */
274
- 0 , /* tp_clear */
275
- 0 , /* tp_richcompare */
276
- 0 , /* tp_weaklistoffset */
277
- 0 , /* tp_iter */
278
- 0 , /* tp_iternext */
279
- 0 , /* tp_methods */
280
- 0 , /* tp_members */
281
- 0 , /* tp_getset */
282
- 0 , // &PyType_Type, /* tp_base */
283
- 0 , /* tp_dict */
284
- 0 , /* tp_descr_get */
285
- 0 , /* tp_descr_set */
286
- 0 , /* tp_dictoffset */
287
- 0 , /* tp_init */
288
- 0 , /* tp_alloc */
289
- 0 , // filled in with type_new /* tp_new */
290
- 0 , // filled in with __PyObject_GC_Del /* tp_free */
291
- (inquiry)type_is_gc, /* tp_is_gc */
292
- 0 , /* tp_bases */
293
- 0 , /* tp_mro */
294
- 0 , /* tp_cache */
295
- 0 , /* tp_subclasses */
296
- 0 , /* tp_weaklist */
297
- #if PYTHON_API_VERSION >= 1012
298
- 0 /* tp_del */
299
- #endif
216
+ .tp_is_gc = (inquiry)type_is_gc,
300
217
};
301
218
302
219
// Install the instance data for a C++ object into a Python instance
@@ -416,54 +333,18 @@ namespace objects
416
333
417
334
static PyTypeObject class_type_object = {
418
335
PyVarObject_HEAD_INIT (NULL , 0 )
419
- const_cast <char *>(" Boost.Python.instance" ),
420
- offsetof (instance<>,storage), /* tp_basicsize */
421
- 1 , /* tp_itemsize */
422
- instance_dealloc, /* tp_dealloc */
423
- 0 , /* tp_print */
424
- 0 , /* tp_getattr */
425
- 0 , /* tp_setattr */
426
- 0 , /* tp_compare */
427
- 0 , /* tp_repr */
428
- 0 , /* tp_as_number */
429
- 0 , /* tp_as_sequence */
430
- 0 , /* tp_as_mapping */
431
- 0 , /* tp_hash */
432
- 0 , /* tp_call */
433
- 0 , /* tp_str */
434
- 0 , /* tp_getattro */
435
- 0 , /* tp_setattro */
436
- 0 , /* tp_as_buffer */
437
- Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC
336
+ .tp_name = const_cast <char *>(" Boost.Python.instance" ),
337
+ .tp_basicsize =offsetof (instance<>,storage),
338
+ .tp_itemsize = 1 ,
339
+ .tp_dealloc = instance_dealloc,
340
+ .tp_flags = Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC
438
341
| Py_TPFLAGS_BASETYPE, /* tp_flags */
439
- 0 , /* tp_doc */
440
- 0 , /* tp_traverse */
441
- 0 , /* tp_clear */
442
- 0 , /* tp_richcompare */
443
- offsetof (instance<>,weakrefs), /* tp_weaklistoffset */
444
- 0 , /* tp_iter */
445
- 0 , /* tp_iternext */
446
- 0 , /* tp_methods */
447
- instance_members, /* tp_members */
448
- instance_getsets, /* tp_getset */
449
- 0 , // &PyBaseObject_Type, /* tp_base */
450
- 0 , /* tp_dict */
451
- 0 , /* tp_descr_get */
452
- 0 , /* tp_descr_set */
453
- offsetof (instance<>,dict), /* tp_dictoffset */
454
- 0 , /* tp_init */
455
- PyType_GenericAlloc, /* tp_alloc */
456
- instance_new, /* tp_new */
457
- 0 , /* tp_free */
458
- 0 , /* tp_is_gc */
459
- 0 , /* tp_bases */
460
- 0 , /* tp_mro */
461
- 0 , /* tp_cache */
462
- 0 , /* tp_subclasses */
463
- 0 , /* tp_weaklist */
464
- #if PYTHON_API_VERSION >= 1012
465
- 0 /* tp_del */
466
- #endif
342
+ .tp_weaklistoffset =offsetof (instance<>,weakrefs),
343
+ .tp_members = instance_members,
344
+ .tp_getset = instance_getsets,
345
+ .tp_dictoffset = offsetof (instance<>,dict),
346
+ .tp_alloc = PyType_GenericAlloc,
347
+ .tp_new = instance_new,
467
348
};
468
349
469
350
BOOST_PYTHON_DECL type_handle class_type ()
0 commit comments