diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg index 2811e326b..69402568e 100644 --- a/Lib/python/builtin.swg +++ b/Lib/python/builtin.swg @@ -1,15 +1,13 @@ #define PYSWIG_UNARYFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a) \ -{ \ - return wrapper(a, NULL); \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a) { \ + return wrapper(a, NULL); \ } #define PYSWIG_DESTRUCTOR_CLOSURE(wrapper) \ SWIGINTERN void \ -wrapper##_closure (PyObject *a) \ -{ \ - SwigPyObject *sobj = (SwigPyObject*) a; \ +wrapper##_closure(PyObject *a) { \ + SwigPyObject *sobj = (SwigPyObject *)a; \ if (sobj->own) { \ PyObject *o = wrapper(a, NULL); \ Py_XDECREF(o); \ @@ -18,8 +16,7 @@ wrapper##_closure (PyObject *a) \ #define PYSWIG_INQUIRY_CLOSURE(wrapper) \ SWIGINTERN int \ -wrapper##_closure (PyObject *a) \ -{ \ +wrapper##_closure(PyObject *a) { \ PyObject *pyresult = wrapper(a, NULL); \ int result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; \ Py_XDECREF(pyresult); \ @@ -27,9 +24,8 @@ wrapper##_closure (PyObject *a) \ } #define PYSWIG_BINARYFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a, PyObject *b) \ -{ \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a, PyObject *b) { \ PyObject *tuple = PyTuple_New(1); \ assert(tuple); \ PyTuple_SET_ITEM(tuple, 0, b); \ @@ -40,9 +36,8 @@ wrapper##_closure (PyObject *a, PyObject *b) \ } #define PYSWIG_TERNARYFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a, PyObject *b, PyObject *c) \ -{ \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \ PyObject *tuple = PyTuple_New(2); \ assert(tuple); \ PyTuple_SET_ITEM(tuple, 0, b); \ @@ -56,8 +51,7 @@ wrapper##_closure (PyObject *a, PyObject *b, PyObject *c) \ #define PYSWIG_LENFUNC_CLOSURE(wrapper) \ SWIGINTERN Py_ssize_t \ -wrapper##_closure (PyObject *a) \ -{ \ +wrapper##_closure(PyObject *a) { \ PyObject *resultobj = wrapper(a, NULL); \ Py_ssize_t result = PyNumber_AsSsize_t(resultobj, NULL); \ Py_DECREF(resultobj); \ @@ -65,9 +59,8 @@ wrapper##_closure (PyObject *a) \ } #define PYSWIG_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a, Py_ssize_t b, Py_ssize_t c) \ -{ \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \ PyObject *tuple = PyTuple_New(2); \ assert(tuple); \ PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ @@ -79,8 +72,7 @@ wrapper##_closure (PyObject *a, Py_ssize_t b, Py_ssize_t c) \ #define PYSWIG_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \ SWIGINTERN int \ -wrapper##_closure (PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) \ -{ \ +wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \ PyObject *tuple = PyTuple_New(d ? 3 : 2); \ assert(tuple); \ PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ @@ -97,9 +89,8 @@ wrapper##_closure (PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) \ } #define PYSWIG_SSIZEARGFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a, Py_ssize_t b) \ -{ \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a, Py_ssize_t b) { \ PyObject *tuple = PyTuple_New(1); \ assert(tuple); \ PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ @@ -109,9 +100,8 @@ wrapper##_closure (PyObject *a, Py_ssize_t b) \ } #define PYSWIG_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a, Py_ssize_t b) \ -{ \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a, Py_ssize_t b) { \ PyObject *arg = _PyLong_FromSsize_t(b); \ PyObject *result = wrapper(a, arg); \ Py_DECREF(arg); \ @@ -120,8 +110,7 @@ wrapper##_closure (PyObject *a, Py_ssize_t b) \ #define PYSWIG_SSIZEOBJARGPROC_CLOSURE(wrapper) \ SWIGINTERN int \ -wrapper##_closure (PyObject *a, Py_ssize_t b, PyObject *c) \ -{ \ +wrapper##_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \ PyObject *tuple = PyTuple_New(2); \ assert(tuple); \ PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ @@ -136,8 +125,7 @@ wrapper##_closure (PyObject *a, Py_ssize_t b, PyObject *c) \ #define PYSWIG_OBJOBJARGPROC_CLOSURE(wrapper) \ SWIGINTERN int \ -wrapper##_closure (PyObject *a, PyObject *b, PyObject *c) \ -{ \ +wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \ PyObject *tuple = PyTuple_New(c ? 2 : 1); \ assert(tuple); \ PyTuple_SET_ITEM(tuple, 0, b); \ @@ -154,16 +142,14 @@ wrapper##_closure (PyObject *a, PyObject *b, PyObject *c) \ } #define PYSWIG_REPRFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a) \ -{ \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a) { \ return wrapper(a, NULL); \ } #define PYSWIG_HASHFUNC_CLOSURE(wrapper) \ SWIGINTERN long \ -wrapper##_closure (PyObject *a) \ -{ \ +wrapper##_closure(PyObject *a) { \ PyObject *pyresult = wrapper(a, NULL); \ if (!pyresult || !PyLong_Check(pyresult)) \ return -1; \ @@ -173,9 +159,8 @@ wrapper##_closure (PyObject *a) \ } #define PYSWIG_ITERNEXT_CLOSURE(wrapper) \ -SWIGINTERN PyObject* \ -wrapper##_closure (PyObject *a) \ -{ \ +SWIGINTERN PyObject * \ +wrapper##_closure(PyObject *a) { \ PyObject *result = wrapper(a, NULL); \ if (result && result == Py_None) { \ Py_DECREF(result); \ @@ -184,288 +169,251 @@ wrapper##_closure (PyObject *a) \ return result; \ } -SWIGINTERN int py_builtin_bad_init (PyObject *self, PyObject *args, PyObject *kwds) -{ - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); - return -1; -} - -SWIGINTERN void py_builtin_bad_dealloc (PyObject *pyobj) -{ - SwigPyObject *sobj = (SwigPyObject*) pyobj; - if (sobj->own) { - PyErr_Format(PyExc_TypeError, - "Swig detected a memory leak in type '%.300s': no callable destructor found.", - pyobj->ob_type->tp_name); - } -} - -typedef struct { - PyCFunction get; - PyCFunction set; -} SwigPyGetSet; - -SWIGINTERN PyObject* -pyswig_getter_closure (PyObject *obj, void *closure) -{ - if (!closure) - return SWIG_Py_Void(); - SwigPyGetSet *getset = (SwigPyGetSet*) closure; - if (!getset->get) - return SWIG_Py_Void(); - PyObject *tuple = PyTuple_New(0); - assert(tuple); - PyObject *result = (*getset->get)(obj, tuple); - Py_DECREF(tuple); - return result; -} - -SWIGINTERN PyObject* -pyswig_funpack_getter_closure (PyObject *obj, void *closure) -{ - if (!closure) - return SWIG_Py_Void(); - SwigPyGetSet *getset = (SwigPyGetSet*) closure; - if (!getset->get) - return SWIG_Py_Void(); - PyObject *result = (*getset->get)(obj, NULL); - return result; -} - SWIGINTERN int -pyswig_setter_closure (PyObject *obj, PyObject *val, void *closure) -{ - if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); - return -1; - } - SwigPyGetSet *getset = (SwigPyGetSet*) closure; - if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); - return -1; - } - PyObject *tuple = PyTuple_New(1); - assert(tuple); - PyTuple_SET_ITEM(tuple, 0, val); - Py_XINCREF(val); - PyObject *result = (*getset->set)(obj, tuple); - Py_DECREF(tuple); - Py_XDECREF(result); - return result ? 0 : -1; -} - -SWIGINTERN int -pyswig_funpack_setter_closure (PyObject *obj, PyObject *val, void *closure) -{ - if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); - return -1; - } - SwigPyGetSet *getset = (SwigPyGetSet*) closure; - if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); - return -1; - } - PyObject *result = (*getset->set)(obj, val); - Py_XDECREF(result); - return result ? 0 : -1; -} - -SWIGINTERN PyObject* -pyswig_static_getter_closure (PyObject *obj, void *closure) -{ - if (!closure) - return SWIG_Py_Void(); - SwigPyGetSet *getset = (SwigPyGetSet*) closure; - if (!getset->get) - return SWIG_Py_Void(); - PyObject *tuple = PyTuple_New(0); - assert(tuple); - PyObject *result = (*getset->get)(obj, tuple); - Py_DECREF(tuple); - return result; -} - -SWIGINTERN int -pyswig_static_setter_closure (PyObject *obj, PyObject *val, void *closure) -{ - if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); - return -1; - } - SwigPyGetSet *getset = (SwigPyGetSet*) closure; - if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal static variable assignment."); - return -1; - } - PyObject *tuple = PyTuple_New(1); - assert(tuple); - PyTuple_SET_ITEM(tuple, 0, val); - Py_XINCREF(val); - PyObject *result = (*getset->set)(obj, tuple); - Py_DECREF(tuple); - Py_XDECREF(result); - return result ? 0 : -1; +py_builtin_bad_init(PyObject *self, PyObject *args, PyObject *kwds) { + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); + return -1; } SWIGINTERN void -SwigPyStaticVar_dealloc(PyDescrObject *descr) -{ - _PyObject_GC_UNTRACK(descr); - Py_XDECREF(descr->d_type); - Py_XDECREF(descr->d_name); - PyObject_GC_Del(descr); +py_builtin_bad_dealloc(PyObject *pyobj) { + SwigPyObject *sobj = (SwigPyObject *)pyobj; + if (sobj->own) { + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", pyobj->ob_type->tp_name); + } +} + +typedef struct { + PyCFunction get; + PyCFunction set; +} SwigPyGetSet; + +SWIGINTERN PyObject * +pyswig_getter_closure(PyObject *obj, void *closure) { + if (!closure) + return SWIG_Py_Void(); + SwigPyGetSet *getset = (SwigPyGetSet *)closure; + if (!getset->get) + return SWIG_Py_Void(); + PyObject *tuple = PyTuple_New(0); + assert(tuple); + PyObject *result = (*getset->get)(obj, tuple); + Py_DECREF(tuple); + return result; } SWIGINTERN PyObject * -SwigPyStaticVar_repr(PyGetSetDescrObject *descr) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat - ("", - descr->d_name, descr->d_type->tp_name); -#else - return PyString_FromFormat - ("", - PyString_AsString(descr->d_name), descr->d_type->tp_name); -#endif +pyswig_funpack_getter_closure(PyObject *obj, void *closure) { + if (!closure) + return SWIG_Py_Void(); + SwigPyGetSet *getset = (SwigPyGetSet *)closure; + if (!getset->get) + return SWIG_Py_Void(); + PyObject *result = (*getset->get)(obj, NULL); + return result; } SWIGINTERN int -SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) -{ - PyDescrObject *descr = (PyDescrObject *)self; - Py_VISIT(descr->d_type); - return 0; -} - -SWIGINTERN PyObject * -SwigPyStaticVar_get (PyGetSetDescrObject *descr, PyObject *obj, PyObject *type) -{ - if (descr->d_getset->get != NULL) - return descr->d_getset->get(obj, descr->d_getset->closure); -#if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, - "attribute '%.300U' of '%.100s' objects is not readable", - descr->d_name, descr->d_type->tp_name); -#else - PyErr_Format(PyExc_AttributeError, - "attribute '%.300s' of '%.100s' objects is not readable", - PyString_AsString(descr->d_name), descr->d_type->tp_name); -#endif - return NULL; -} - -SWIGINTERN int -SwigPyStaticVar_set (PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) -{ - int res; - - if (descr->d_getset->set != NULL) - return descr->d_getset->set(obj, value, descr->d_getset->closure); -#if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, - "attribute '%.300U' of '%.100s' objects is not writable", - descr->d_name, - descr->d_type->tp_name); -#else - PyErr_Format(PyExc_AttributeError, - "attribute '%.300s' of '%.100s' objects is not writable", - PyString_AsString(descr->d_name), - descr->d_type->tp_name); -#endif +pyswig_setter_closure(PyObject *obj, PyObject *val, void *closure) { + if (!closure) { + PyErr_Format(PyExc_TypeError, "Missing getset closure"); return -1; + } + SwigPyGetSet *getset = (SwigPyGetSet *)closure; + if (!getset->set) { + PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); + return -1; + } + PyObject *tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, val); + Py_XINCREF(val); + PyObject *result = (*getset->set)(obj, tuple); + Py_DECREF(tuple); + Py_XDECREF(result); + return result ? 0 : -1; +} + +SWIGINTERN int +pyswig_funpack_setter_closure(PyObject *obj, PyObject *val, void *closure) { + if (!closure) { + PyErr_Format(PyExc_TypeError, "Missing getset closure"); + return -1; + } + SwigPyGetSet *getset = (SwigPyGetSet *)closure; + if (!getset->set) { + PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); + return -1; + } + PyObject *result = (*getset->set)(obj, val); + Py_XDECREF(result); + return result ? 0 : -1; +} + +SWIGINTERN PyObject * +pyswig_static_getter_closure(PyObject *obj, void *closure) { + if (!closure) + return SWIG_Py_Void(); + SwigPyGetSet *getset = (SwigPyGetSet *)closure; + if (!getset->get) + return SWIG_Py_Void(); + PyObject *tuple = PyTuple_New(0); + assert(tuple); + PyObject *result = (*getset->get)(obj, tuple); + Py_DECREF(tuple); + return result; +} + +SWIGINTERN int +pyswig_static_setter_closure(PyObject *obj, PyObject *val, void *closure) { + if (!closure) { + PyErr_Format(PyExc_TypeError, "Missing getset closure"); + return -1; + } + SwigPyGetSet *getset = (SwigPyGetSet *)closure; + if (!getset->set) { + PyErr_Format(PyExc_TypeError, "Illegal static variable assignment."); + return -1; + } + PyObject *tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, val); + Py_XINCREF(val); + PyObject *result = (*getset->set)(obj, tuple); + Py_DECREF(tuple); + Py_XDECREF(result); + return result ? 0 : -1; +} + +SWIGINTERN void +SwigPyStaticVar_dealloc(PyDescrObject *descr) { + _PyObject_GC_UNTRACK(descr); + Py_XDECREF(descr->d_type); + Py_XDECREF(descr->d_name); + PyObject_GC_Del(descr); +} + +SWIGINTERN PyObject * +SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromFormat("", descr->d_name, descr->d_type->tp_name); +#else + return PyString_FromFormat("", PyString_AsString(descr->d_name), descr->d_type->tp_name); +#endif +} + +SWIGINTERN int +SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) { + PyDescrObject *descr = (PyDescrObject *)self; + Py_VISIT(descr->d_type); + return 0; +} + +SWIGINTERN PyObject * +SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *type) { + if (descr->d_getset->get != NULL) + return descr->d_getset->get(obj, descr->d_getset->closure); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "attribute '%.300U' of '%.100s' objects is not readable", descr->d_name, descr->d_type->tp_name); +#else + PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(descr->d_name), descr->d_type->tp_name); +#endif + return NULL; +} + +SWIGINTERN int +SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) { + int res; + + if (descr->d_getset->set != NULL) + return descr->d_getset->set(obj, value, descr->d_getset->closure); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "attribute '%.300U' of '%.100s' objects is not writable", descr->d_name, descr->d_type->tp_name); +#else + PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(descr->d_name), descr->d_type->tp_name); +#endif + return -1; } SWIGINTERN PyTypeObject SwigPyStaticVar_Type = { #if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(&PyType_Type, 0) + PyVarObject_HEAD_INIT(&PyType_Type, 0) #else - PyObject_HEAD_INIT(&PyType_Type) - 0, + 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 */ + "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 */ }; SWIGINTERN int -SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) -{ - PyObject *attribute = _PyType_Lookup(type, name); - if (attribute != NULL) { - /* Implement descriptor functionality, if any */ - descrsetfunc local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject*) type, value); +SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) { + PyObject *attribute = _PyType_Lookup(type, name); + if (attribute != NULL) { + /* Implement descriptor functionality, if any */ + descrsetfunc local_set = attribute->ob_type->tp_descr_set; + if (local_set != NULL) + return local_set(attribute, (PyObject *)type, value); #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, - "cannot modify read-only attribute '%.50s.%.400U'", - type->tp_name, name); -#else - PyErr_Format(PyExc_AttributeError, - "cannot modify read-only attribute '%.50s.%.400s'", - type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400U'", type->tp_name, name); +#else + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400s'", type->tp_name, PyString_AS_STRING(name)); #endif - } else { + } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, - "type '%.50s' has no attribute '%.400U'", - type->tp_name, name); + PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400U'", type->tp_name, name); #else - PyErr_Format(PyExc_AttributeError, - "type '%.50s' has no attribute '%.400s'", - type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); #endif - } + } - return -1; + return -1; } -SWIGINTERN PyGetSetDescrObject* -SwigPyStaticVar_new_getset (PyTypeObject *type, PyGetSetDef *getset) -{ - PyGetSetDescrObject *descr = (PyGetSetDescrObject*) PyType_GenericAlloc(&SwigPyStaticVar_Type, 0); - assert(descr); - Py_XINCREF(type); - descr->d_type = type; - descr->d_name = PyString_InternFromString(getset->name); - descr->d_getset = getset; - if (descr->d_name == NULL) { - Py_DECREF(descr); - descr = NULL; - } - return descr; +SWIGINTERN PyGetSetDescrObject * +SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) { + PyGetSetDescrObject *descr = (PyGetSetDescrObject *)PyType_GenericAlloc(&SwigPyStaticVar_Type, 0); + assert(descr); + Py_XINCREF(type); + descr->d_type = type; + descr->d_name = PyString_InternFromString(getset->name); + descr->d_getset = getset; + if (descr->d_name == NULL) { + Py_DECREF(descr); + descr = NULL; + } + return descr; } #ifdef __cplusplus @@ -473,27 +421,25 @@ SwigPyStaticVar_new_getset (PyTypeObject *type, PyGetSetDef *getset) #include SWIGINTERN void -pyswig_builtin_init_bases (PyTypeObject *type, std::vector& bases) -{ - if (!bases.size()) - bases.push_back(SwigPyObject_type()); - type->tp_base = bases[0]; - Py_INCREF((PyObject*) bases[0]); - PyObject *tuple = PyTuple_New(bases.size()); - int i; - for (i = 0; i < bases.size(); ++i) { - PyTuple_SET_ITEM(tuple, i, (PyObject*) bases[i]); - Py_INCREF((PyObject*) bases[i]); - } - type->tp_bases = tuple; +pyswig_builtin_init_bases(PyTypeObject *type, std::vector &bases) { + if (!bases.size()) + bases.push_back(SwigPyObject_type()); + type->tp_base = bases[0]; + Py_INCREF((PyObject *)bases[0]); + PyObject *tuple = PyTuple_New(bases.size()); + int i; + for (i = 0; i < bases.size(); ++i) { + PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]); + Py_INCREF((PyObject *)bases[i]); + } + type->tp_bases = tuple; } -SWIGINTERN PyObject* -pyswig_this_closure (PyObject *self, void *closure) -{ - PyObject *result = (PyObject*) SWIG_Python_GetSwigThis(self); - Py_XINCREF(result); - return result; -} +SWIGINTERN PyObject * +pyswig_this_closure(PyObject *self, void *closure) { + PyObject *result = (PyObject *)SWIG_Python_GetSwigThis(self); + Py_XINCREF(result); + return result; +} #endif diff --git a/Lib/python/director.swg b/Lib/python/director.swg index 95dc991cd..5749ee74b 100644 --- a/Lib/python/director.swg +++ b/Lib/python/director.swg @@ -461,12 +461,13 @@ namespace Swig { } template - static PyObject* pyobj_disown (PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args)) + static PyObject* pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args)) { - SwigPyObject *sobj = (SwigPyObject *) pyobj; + SwigPyObject *sobj = (SwigPyObject *)pyobj; sobj->own = 0; - Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<_Tp*>(sobj->ptr)); - if (d) d->swig_disown(); + Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<_Tp *>(sobj->ptr)); + if (d) + d->swig_disown(); return PyWeakref_NewProxy(pyobj, NULL); } diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg index bc19c33fb..5f777894b 100644 --- a/Lib/python/pyinit.swg +++ b/Lib/python/pyinit.swg @@ -352,7 +352,7 @@ SWIG_init(void) { // metatype is used to implement static member variables. PyObject *metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); assert(metatype_args); - PyTypeObject *metatype = (PyTypeObject*) PyType_Type.tp_call((PyObject*) &PyType_Type, metatype_args, NULL); + PyTypeObject *metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL); assert(metatype); Py_DECREF(metatype_args); metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro; @@ -386,7 +386,7 @@ SWIG_init(void) { // All objects have a 'this' attribute static PyGetSetDef this_getset_def = { - const_cast("this"), pyswig_this_closure, NULL, NULL, NULL + const_cast("this"), pyswig_this_closure, NULL, NULL, NULL }; PyObject *this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 8957b3192..393bc6ddd 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -74,7 +74,7 @@ SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { #if defined(SWIGPYTHON_BUILTIN) SWIGINTERN void -pyswig_add_public_symbol (PyObject *seq, const char *key) { +pyswig_add_public_symbol(PyObject *seq, const char *key) { PyObject *s = PyString_InternFromString(key); PyList_Append(seq, s); Py_DECREF(s); @@ -82,7 +82,7 @@ pyswig_add_public_symbol (PyObject *seq, const char *key) { SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { - PyDict_SetItemString(d, (char*) name, obj); + PyDict_SetItemString(d, (char *)name, obj); Py_DECREF(obj); if (public_interface) pyswig_add_public_symbol(public_interface, name); @@ -92,7 +92,7 @@ SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *nam SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { - PyDict_SetItemString(d, (char*) name, obj); + PyDict_SetItemString(d, (char *)name, obj); Py_DECREF(obj); } @@ -338,8 +338,7 @@ SwigPyClientData_New(PyObject* obj) } SWIGRUNTIME void -SwigPyClientData_Del(SwigPyClientData* data) -{ +SwigPyClientData_Del(SwigPyClientData *data) { Py_XDECREF(data->newraw); Py_XDECREF(data->newargs); Py_XDECREF(data->destroy); @@ -1127,106 +1126,84 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int return SWIG_OK; } - /* - if (ty && ty->clientdata && ((SwigPyClientData*) ty->clientdata)->pytype) { - PyTypeObject *target_tp = ((SwigPyClientData*) ty->clientdata)->pytype; - SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); - for (; sobj; sobj = (SwigPyObject*) sobj->next) { - if (!sobj->ty->clientdata) - continue; - PyTypeObject *candidate_tp = ((SwigPyClientData*) sobj->ty->clientdata)->pytype; - if (candidate_tp && PyType_IsSubtype(candidate_tp, target_tp)) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) - sobj->own = 0; - if (ptr) - *ptr = sobj->ptr; - return SWIG_OK; - } - } - return SWIG_ERROR; - } - */ - int res = SWIG_ERROR; SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); if (own) - *own = 0; + *own = 0; while (sobj) { - void *vptr = sobj->ptr; - if (ty) { - swig_type_info *to = sobj->ty; - if (to == ty) { - /* no type cast needed */ - if (ptr) *ptr = vptr; - break; - } else { - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) { - sobj = (SwigPyObject *)sobj->next; - } else { - if (ptr) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (own) - *own = *own | SWIG_CAST_NEW_MEMORY; - } - } - break; - } - } - } else { - if (ptr) *ptr = vptr; - break; - } + void *vptr = sobj->ptr; + if (ty) { + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (SwigPyObject *)sobj->next; + } else { + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } + break; + } + } + } else { + if (ptr) *ptr = vptr; + break; + } } if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; - } - res = SWIG_OK; + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + res = SWIG_OK; } else { - if (flags & SWIG_POINTER_IMPLICIT_CONV) { - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - if (data && !data->implicitconv) { - PyObject *klass = data->klass; - if (klass) { - PyObject *impconv; - data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ - impconv = SWIG_Python_CallFunctor(klass, obj); - data->implicitconv = 0; - if (PyErr_Occurred()) { - PyErr_Clear(); - impconv = 0; - } - if (impconv) { - SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); - if (iobj) { - void *vptr; - res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); - if (SWIG_IsOK(res)) { - if (ptr) { - *ptr = vptr; - /* transfer the ownership to 'ptr' */ - iobj->own = 0; - res = SWIG_AddCast(res); - res = SWIG_AddNewMask(res); - } else { - res = SWIG_AddCast(res); - } - } - } - Py_DECREF(impconv); - } - } - } - } + if (flags & SWIG_POINTER_IMPLICIT_CONV) { + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + } } return res; } @@ -1399,35 +1376,35 @@ SWIG_Python_InitShadowInstance(PyObject *args) { SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { - if (!ptr) - return SWIG_Py_Void(); + if (!ptr) + return SWIG_Py_Void(); - SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; - int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - if (clientdata && clientdata->pytype) { - SwigPyObject *newobj = PyObject_New(SwigPyObject, clientdata->pytype); - if (newobj) { - newobj->ptr = ptr; - newobj->ty = type; - newobj->own = own; - newobj->next = 0; + SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (clientdata && clientdata->pytype) { + SwigPyObject *newobj = PyObject_New(SwigPyObject, clientdata->pytype); + if (newobj) { + newobj->ptr = ptr; + newobj->ty = type; + newobj->own = own; + newobj->next = 0; #ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; + newobj->dict = 0; #endif - return (PyObject*) newobj; - } - return SWIG_Py_Void(); + return (PyObject*) newobj; } + return SWIG_Py_Void(); + } - PyObject *robj = SwigPyObject_New(ptr, type, own); - if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { - PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); - if (inst) { - Py_DECREF(robj); - robj = inst; - } + PyObject *robj = SwigPyObject_New(ptr, type, own); + if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + if (inst) { + Py_DECREF(robj); + robj = inst; } - return robj; + } + return robj; } /* Create a new packed object */ @@ -1444,12 +1421,12 @@ SWIG_Python_NewBuiltinObj(PyObject *self, void *ptr, swig_type_info *type, int f assert(clientdata); assert(clientdata->pytype); int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - SwigPyObject *newobj = (SwigPyObject*) self; + SwigPyObject *newobj = (SwigPyObject *)self; if (newobj->ptr) { PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); - while (newobj->next) newobj = (SwigPyObject*) newobj->next; + while (newobj->next) newobj = (SwigPyObject *)newobj->next; newobj->next = next_self; - newobj = (SwigPyObject*) next_self; + newobj = (SwigPyObject *)next_self; } newobj->ptr = ptr; newobj->own = own; @@ -1696,55 +1673,52 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) // Cribbed from Objects/object.c in the python source code and modified SWIGRUNTIME int -SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) -{ - PyTypeObject *tp = obj->ob_type; - PyObject *descr; - descrsetfunc f; - int res = -1; +SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + descrsetfunc f; + int res = -1; #ifdef Py_USING_UNICODE - if (PyString_Check(name)) { - name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); - if (name == NULL) - return -1; - } else if (!PyUnicode_Check(name)) { + if (PyString_Check(name)) { + name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); + if (!name) + return -1; + } else if (!PyUnicode_Check(name)) { #else if (!PyString_Check(name)) { #endif - PyErr_Format(PyExc_TypeError, - "attribute name must be string, not '%.200s'", - name->ob_type->tp_name); - return -1; + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); + return -1; } else { - Py_INCREF(name); + Py_INCREF(name); } - if (tp->tp_dict == NULL) { - if (PyType_Ready(tp) < 0) - goto done; + if (!tp->tp_dict) { + if (PyType_Ready(tp) < 0) + goto done; } descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; - if (f == NULL) { - PyErr_Format(PyExc_AttributeError, + f = descr->ob_type->tp_descr_set; + if (!f) { + PyErr_Format(PyExc_AttributeError, #ifdef Py_USING_UNICODE - "'%.100s' object has no attribute '%.200U'", + "'%.100s' object has no attribute '%.200U'", #else - "'%.100s' object has no attribute '%.200S'", + "'%.100s' object has no attribute '%.200S'", #endif - tp->tp_name, name); + tp->tp_name, name); } else { - res = f(descr, obj, value); + res = f(descr, obj, value); } - - done: + +done: Py_DECREF(name); return res; - } + } #ifdef __cplusplus diff --git a/Lib/python/pyruntime.swg b/Lib/python/pyruntime.swg index 77abd47bd..c20ed964f 100644 --- a/Lib/python/pyruntime.swg +++ b/Lib/python/pyruntime.swg @@ -10,5 +10,4 @@ %insert(runtime) "pythreads.swg"; /* Python thread code */ %insert(runtime) "pyapi.swg"; /* Python API */ %insert(runtime) "pyrun.swg"; /* Python run-time code */ - %insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */ diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i index 8dcb90fe5..2b3a90747 100644 --- a/Lib/python/std_map.i +++ b/Lib/python/std_map.i @@ -291,10 +291,10 @@ #endif %extend { - // This will be called through the mp_ass_subscript slot to delete an entry. - void __setitem__(const key_type& key) { - self->erase(key); - } + // This will be called through the mp_ass_subscript slot to delete an entry. + void __setitem__(const key_type& key) { + self->erase(key); + } } %extend { diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 693ac0f98..14fdb52b0 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -240,9 +240,11 @@ public: } /* ------------------------------------------------------------ * Thread Implementation - * ------------------------------------------------------------ */ int threads_enable(Node *n) const { + * ------------------------------------------------------------ */ + int threads_enable(Node *n) const { return threads && !GetFlagAttr(n, "feature:nothread"); } + int initialize_threads(String *f_init) { if (!threads) { return SWIG_OK; @@ -510,7 +512,7 @@ public: } } - } /* for */ + } if (py3) { /* force disable features that not compatible with Python 3.x */ @@ -882,11 +884,11 @@ public: * But don't sure wether this would broken old Python? */ Printv(f_shadow, - // "import types\n", +// "import types\n", "try:\n", - // " _object = types.ObjectType\n", +// " _object = types.ObjectType\n", " _object = object\n", " _newclass = 1\n", "except AttributeError:\n", " class _object : pass\n", " _newclass = 0\n", - // "del types\n", +// "del types\n", "\n\n", NIL); } } @@ -995,8 +997,6 @@ public: } Dump(f_wrappers, f_begin); - //if (builtin) - //Dump(f_builtins, f_begin); Wrapper_pretty_print(f_init, f_begin); Delete(f_header); @@ -3186,7 +3186,7 @@ public: String *mname = SwigType_manglestr(rname); Printf(f_init, "\n// type '%s'\n", rname); - Printf(f_init, " builtin_pytype = (PyTypeObject*) &SwigPyBuiltin_%s_type;\n", mname); + Printf(f_init, " builtin_pytype = (PyTypeObject *)&SwigPyBuiltin_%s_type;\n", mname); Printf(f_init, " builtin_pytype->tp_dict = d = PyDict_New();\n"); Delete(rname); @@ -3277,38 +3277,37 @@ public: // Rich compare function Hash *richcompare = Getattr(n, "richcompare"); assert(richcompare); - Printf(f, "SWIGINTERN PyObject*\n"); - Printf(f, "%s_richcompare (PyObject *self, PyObject *other, int op)\n", templ); - Printf(f, "{\n"); - Printf(f, " PyObject *result = NULL;\n"); + Printf(f, "SWIGINTERN PyObject *\n"); + Printf(f, "%s_richcompare(PyObject *self, PyObject *other, int op) {\n", templ); + Printf(f, " PyObject *result = NULL;\n"); if (!funpack) { - Printf(f, " PyObject *tuple = PyTuple_New(1);\n"); - Printf(f, " assert(tuple);\n"); - Printf(f, " PyTuple_SET_ITEM(tuple, 0, other);\n"); - Printf(f, " Py_XINCREF(other);\n"); + Printf(f, " PyObject *tuple = PyTuple_New(1);\n"); + Printf(f, " assert(tuple);\n"); + Printf(f, " PyTuple_SET_ITEM(tuple, 0, other);\n"); + Printf(f, " Py_XINCREF(other);\n"); } - Printf(f, " switch (op) {\n"); + Printf(f, " switch (op) {\n"); for (Iterator i = First(richcompare); i.item; i = Next(i)) Printf(f, " case %s : result = %s(self, %s); break;\n", i.key, i.item, funpack ? "other" : "tuple"); Printv(f, " default : break;\n", NIL); - Printf(f, " }\n"); - Printv(f, " if (result == NULL) {\n", NIL); - Printv(f, " if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) {\n", NIL); - Printv(f, " result = SwigPyObject_richcompare((SwigPyObject*) self, (SwigPyObject*) other, op);\n", NIL); - Printv(f, " } else {\n", NIL); - Printv(f, " result = Py_NotImplemented;\n", NIL); - Printv(f, " Py_INCREF(result);\n", NIL); - Printv(f, " }\n", NIL); + Printf(f, " }\n"); + Printv(f, " if (!result) {\n", NIL); + Printv(f, " if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) {\n", NIL); + Printv(f, " result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op);\n", NIL); + Printv(f, " } else {\n", NIL); + Printv(f, " result = Py_NotImplemented;\n", NIL); + Printv(f, " Py_INCREF(result);\n", NIL); Printv(f, " }\n", NIL); + Printv(f, " }\n", NIL); if (!funpack) - Printf(f, " Py_DECREF(tuple);\n"); - Printf(f, " return result;\n"); + Printf(f, " Py_DECREF(tuple);\n"); + Printf(f, " return result;\n"); Printf(f, "}\n\n"); // Methods Printf(f, "SWIGINTERN PyMethodDef %s_methods[] = {\n", templ); Dump(builtin_methods, f); - Printf(f, " {NULL} // Sentinel\n};\n\n"); + Printf(f, " {NULL} // Sentinel\n};\n\n"); // No instance dict for nondynamic objects if (GetFlag(n, "feature:python:nondynamic")) @@ -3502,7 +3501,7 @@ public: Printf(clientdata_klass, "(PyObject*) &%s_type", templ); } - Printf(f, "SWIGINTERN SwigPyClientData %s_clientdata = {%s, 0, 0, 0, 0, 0, (PyTypeObject*) &%s_type};\n\n", templ, clientdata_klass, templ); + Printf(f, "SWIGINTERN SwigPyClientData %s_clientdata = {%s, 0, 0, 0, 0, 0, (PyTypeObject *)&%s_type};\n\n", templ, clientdata_klass, templ); Printv(f_init, " if (PyType_Ready(builtin_pytype) < 0) {\n", NIL); Printf(f_init, " PyErr_SetString(PyExc_TypeError, \"Couldn't create type '%s'\");\n", symname);