PyVarObject_HEAD_INIT to conform to C standard - pointers cannot be used in static initializers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12661 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
63f21af8d0
commit
1aa65e2220
1 changed files with 81 additions and 63 deletions
|
|
@ -336,68 +336,6 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value)
|
|||
return -1;
|
||||
}
|
||||
|
||||
SWIGINTERN PyTypeObject SwigPyStaticVar_Type = {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
#else
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
#endif
|
||||
"swig_static_var_getset_descriptor",
|
||||
sizeof(PyGetSetDescrObject),
|
||||
0,
|
||||
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
(reprfunc)SwigPyStaticVar_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
SwigPyStaticVar_traverse, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
(descrgetfunc)SwigPyStaticVar_get, /* tp_descr_get */
|
||||
(descrsetfunc)SwigPyStaticVar_set, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
0, /* tp_new */
|
||||
0, /* tp_free */
|
||||
0, /* tp_is_gc */
|
||||
0, /* tp_bases */
|
||||
0, /* tp_mro */
|
||||
0, /* tp_cache */
|
||||
0, /* tp_subclasses */
|
||||
0, /* tp_weaklist */
|
||||
#if PY_VERSION_HEX >= 0x02030000
|
||||
0, /* tp_del */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02060000
|
||||
0, /* tp_version */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
|
||||
SWIGINTERN int
|
||||
SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) {
|
||||
PyObject *attribute;
|
||||
|
|
@ -424,10 +362,90 @@ SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
SWIGINTERN PyTypeObject*
|
||||
SwigPyStaticVar_Type(void) {
|
||||
static PyTypeObject staticvar_type;
|
||||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp = {
|
||||
/* PyObject header changed in Python 3 */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
#else
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
#endif
|
||||
"swig_static_var_getset_descriptor",
|
||||
sizeof(PyGetSetDescrObject),
|
||||
0,
|
||||
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
(reprfunc)SwigPyStaticVar_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
SwigPyStaticVar_traverse, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
(descrgetfunc)SwigPyStaticVar_get, /* tp_descr_get */
|
||||
(descrsetfunc)SwigPyStaticVar_set, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
0, /* tp_new */
|
||||
0, /* tp_free */
|
||||
0, /* tp_is_gc */
|
||||
0, /* tp_bases */
|
||||
0, /* tp_mro */
|
||||
0, /* tp_cache */
|
||||
0, /* tp_subclasses */
|
||||
0, /* tp_weaklist */
|
||||
#if PY_VERSION_HEX >= 0x02030000
|
||||
0, /* tp_del */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02060000
|
||||
0, /* tp_version */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
staticvar_type = tmp;
|
||||
type_init = 1;
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
staticvar_type.ob_type = &PyType_Type;
|
||||
#else
|
||||
if (PyType_Ready(&staticvar_type) < 0)
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
return &staticvar_type;
|
||||
}
|
||||
|
||||
SWIGINTERN PyGetSetDescrObject *
|
||||
SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {
|
||||
|
||||
PyGetSetDescrObject *descr;
|
||||
descr = (PyGetSetDescrObject *)PyType_GenericAlloc(&SwigPyStaticVar_Type, 0);
|
||||
descr = (PyGetSetDescrObject *)PyType_GenericAlloc(SwigPyStaticVar_Type(), 0);
|
||||
assert(descr);
|
||||
Py_XINCREF(type);
|
||||
PyDescr_TYPE(descr) = type;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue