Coding style fixes for Python builtin changes added on the szager-builtin branch
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12515 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
97802ab8c4
commit
908c37cef8
7 changed files with 425 additions and 506 deletions
|
|
@ -1,14 +1,12 @@
|
||||||
#define PYSWIG_UNARYFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_UNARYFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a) \
|
wrapper##_closure(PyObject *a) { \
|
||||||
{ \
|
|
||||||
return wrapper(a, NULL); \
|
return wrapper(a, NULL); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PYSWIG_DESTRUCTOR_CLOSURE(wrapper) \
|
#define PYSWIG_DESTRUCTOR_CLOSURE(wrapper) \
|
||||||
SWIGINTERN void \
|
SWIGINTERN void \
|
||||||
wrapper##_closure (PyObject *a) \
|
wrapper##_closure(PyObject *a) { \
|
||||||
{ \
|
|
||||||
SwigPyObject *sobj = (SwigPyObject *)a; \
|
SwigPyObject *sobj = (SwigPyObject *)a; \
|
||||||
if (sobj->own) { \
|
if (sobj->own) { \
|
||||||
PyObject *o = wrapper(a, NULL); \
|
PyObject *o = wrapper(a, NULL); \
|
||||||
|
|
@ -18,8 +16,7 @@ wrapper##_closure (PyObject *a) \
|
||||||
|
|
||||||
#define PYSWIG_INQUIRY_CLOSURE(wrapper) \
|
#define PYSWIG_INQUIRY_CLOSURE(wrapper) \
|
||||||
SWIGINTERN int \
|
SWIGINTERN int \
|
||||||
wrapper##_closure (PyObject *a) \
|
wrapper##_closure(PyObject *a) { \
|
||||||
{ \
|
|
||||||
PyObject *pyresult = wrapper(a, NULL); \
|
PyObject *pyresult = wrapper(a, NULL); \
|
||||||
int result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; \
|
int result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; \
|
||||||
Py_XDECREF(pyresult); \
|
Py_XDECREF(pyresult); \
|
||||||
|
|
@ -28,8 +25,7 @@ wrapper##_closure (PyObject *a) \
|
||||||
|
|
||||||
#define PYSWIG_BINARYFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_BINARYFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a, PyObject *b) \
|
wrapper##_closure(PyObject *a, PyObject *b) { \
|
||||||
{ \
|
|
||||||
PyObject *tuple = PyTuple_New(1); \
|
PyObject *tuple = PyTuple_New(1); \
|
||||||
assert(tuple); \
|
assert(tuple); \
|
||||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
PyTuple_SET_ITEM(tuple, 0, b); \
|
||||||
|
|
@ -41,8 +37,7 @@ wrapper##_closure (PyObject *a, PyObject *b) \
|
||||||
|
|
||||||
#define PYSWIG_TERNARYFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_TERNARYFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a, PyObject *b, PyObject *c) \
|
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
|
||||||
{ \
|
|
||||||
PyObject *tuple = PyTuple_New(2); \
|
PyObject *tuple = PyTuple_New(2); \
|
||||||
assert(tuple); \
|
assert(tuple); \
|
||||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
PyTuple_SET_ITEM(tuple, 0, b); \
|
||||||
|
|
@ -56,8 +51,7 @@ wrapper##_closure (PyObject *a, PyObject *b, PyObject *c) \
|
||||||
|
|
||||||
#define PYSWIG_LENFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_LENFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN Py_ssize_t \
|
SWIGINTERN Py_ssize_t \
|
||||||
wrapper##_closure (PyObject *a) \
|
wrapper##_closure(PyObject *a) { \
|
||||||
{ \
|
|
||||||
PyObject *resultobj = wrapper(a, NULL); \
|
PyObject *resultobj = wrapper(a, NULL); \
|
||||||
Py_ssize_t result = PyNumber_AsSsize_t(resultobj, NULL); \
|
Py_ssize_t result = PyNumber_AsSsize_t(resultobj, NULL); \
|
||||||
Py_DECREF(resultobj); \
|
Py_DECREF(resultobj); \
|
||||||
|
|
@ -66,8 +60,7 @@ wrapper##_closure (PyObject *a) \
|
||||||
|
|
||||||
#define PYSWIG_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a, Py_ssize_t b, Py_ssize_t c) \
|
wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \
|
||||||
{ \
|
|
||||||
PyObject *tuple = PyTuple_New(2); \
|
PyObject *tuple = PyTuple_New(2); \
|
||||||
assert(tuple); \
|
assert(tuple); \
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
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) \
|
#define PYSWIG_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN int \
|
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); \
|
PyObject *tuple = PyTuple_New(d ? 3 : 2); \
|
||||||
assert(tuple); \
|
assert(tuple); \
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
||||||
|
|
@ -98,8 +90,7 @@ wrapper##_closure (PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) \
|
||||||
|
|
||||||
#define PYSWIG_SSIZEARGFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a, Py_ssize_t b) \
|
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
||||||
{ \
|
|
||||||
PyObject *tuple = PyTuple_New(1); \
|
PyObject *tuple = PyTuple_New(1); \
|
||||||
assert(tuple); \
|
assert(tuple); \
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
||||||
|
|
@ -110,8 +101,7 @@ wrapper##_closure (PyObject *a, Py_ssize_t b) \
|
||||||
|
|
||||||
#define PYSWIG_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a, Py_ssize_t b) \
|
wrapper##_closure(PyObject *a, Py_ssize_t b) { \
|
||||||
{ \
|
|
||||||
PyObject *arg = _PyLong_FromSsize_t(b); \
|
PyObject *arg = _PyLong_FromSsize_t(b); \
|
||||||
PyObject *result = wrapper(a, arg); \
|
PyObject *result = wrapper(a, arg); \
|
||||||
Py_DECREF(arg); \
|
Py_DECREF(arg); \
|
||||||
|
|
@ -120,8 +110,7 @@ wrapper##_closure (PyObject *a, Py_ssize_t b) \
|
||||||
|
|
||||||
#define PYSWIG_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
#define PYSWIG_SSIZEOBJARGPROC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN int \
|
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); \
|
PyObject *tuple = PyTuple_New(2); \
|
||||||
assert(tuple); \
|
assert(tuple); \
|
||||||
PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \
|
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) \
|
#define PYSWIG_OBJOBJARGPROC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN int \
|
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); \
|
PyObject *tuple = PyTuple_New(c ? 2 : 1); \
|
||||||
assert(tuple); \
|
assert(tuple); \
|
||||||
PyTuple_SET_ITEM(tuple, 0, b); \
|
PyTuple_SET_ITEM(tuple, 0, b); \
|
||||||
|
|
@ -155,15 +143,13 @@ wrapper##_closure (PyObject *a, PyObject *b, PyObject *c) \
|
||||||
|
|
||||||
#define PYSWIG_REPRFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_REPRFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a) \
|
wrapper##_closure(PyObject *a) { \
|
||||||
{ \
|
|
||||||
return wrapper(a, NULL); \
|
return wrapper(a, NULL); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PYSWIG_HASHFUNC_CLOSURE(wrapper) \
|
#define PYSWIG_HASHFUNC_CLOSURE(wrapper) \
|
||||||
SWIGINTERN long \
|
SWIGINTERN long \
|
||||||
wrapper##_closure (PyObject *a) \
|
wrapper##_closure(PyObject *a) { \
|
||||||
{ \
|
|
||||||
PyObject *pyresult = wrapper(a, NULL); \
|
PyObject *pyresult = wrapper(a, NULL); \
|
||||||
if (!pyresult || !PyLong_Check(pyresult)) \
|
if (!pyresult || !PyLong_Check(pyresult)) \
|
||||||
return -1; \
|
return -1; \
|
||||||
|
|
@ -174,8 +160,7 @@ wrapper##_closure (PyObject *a) \
|
||||||
|
|
||||||
#define PYSWIG_ITERNEXT_CLOSURE(wrapper) \
|
#define PYSWIG_ITERNEXT_CLOSURE(wrapper) \
|
||||||
SWIGINTERN PyObject * \
|
SWIGINTERN PyObject * \
|
||||||
wrapper##_closure (PyObject *a) \
|
wrapper##_closure(PyObject *a) { \
|
||||||
{ \
|
|
||||||
PyObject *result = wrapper(a, NULL); \
|
PyObject *result = wrapper(a, NULL); \
|
||||||
if (result && result == Py_None) { \
|
if (result && result == Py_None) { \
|
||||||
Py_DECREF(result); \
|
Py_DECREF(result); \
|
||||||
|
|
@ -184,19 +169,17 @@ wrapper##_closure (PyObject *a) \
|
||||||
return result; \
|
return result; \
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN int py_builtin_bad_init (PyObject *self, PyObject *args, PyObject *kwds)
|
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);
|
PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN void py_builtin_bad_dealloc (PyObject *pyobj)
|
SWIGINTERN void
|
||||||
{
|
py_builtin_bad_dealloc(PyObject *pyobj) {
|
||||||
SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
||||||
if (sobj->own) {
|
if (sobj->own) {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", pyobj->ob_type->tp_name);
|
||||||
"Swig detected a memory leak in type '%.300s': no callable destructor found.",
|
|
||||||
pyobj->ob_type->tp_name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,8 +189,7 @@ typedef struct {
|
||||||
} SwigPyGetSet;
|
} SwigPyGetSet;
|
||||||
|
|
||||||
SWIGINTERN PyObject *
|
SWIGINTERN PyObject *
|
||||||
pyswig_getter_closure (PyObject *obj, void *closure)
|
pyswig_getter_closure(PyObject *obj, void *closure) {
|
||||||
{
|
|
||||||
if (!closure)
|
if (!closure)
|
||||||
return SWIG_Py_Void();
|
return SWIG_Py_Void();
|
||||||
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
||||||
|
|
@ -221,8 +203,7 @@ pyswig_getter_closure (PyObject *obj, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN PyObject *
|
SWIGINTERN PyObject *
|
||||||
pyswig_funpack_getter_closure (PyObject *obj, void *closure)
|
pyswig_funpack_getter_closure(PyObject *obj, void *closure) {
|
||||||
{
|
|
||||||
if (!closure)
|
if (!closure)
|
||||||
return SWIG_Py_Void();
|
return SWIG_Py_Void();
|
||||||
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
||||||
|
|
@ -233,8 +214,7 @@ pyswig_funpack_getter_closure (PyObject *obj, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
pyswig_setter_closure (PyObject *obj, PyObject *val, void *closure)
|
pyswig_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
||||||
{
|
|
||||||
if (!closure) {
|
if (!closure) {
|
||||||
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -255,8 +235,7 @@ pyswig_setter_closure (PyObject *obj, PyObject *val, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
pyswig_funpack_setter_closure (PyObject *obj, PyObject *val, void *closure)
|
pyswig_funpack_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
||||||
{
|
|
||||||
if (!closure) {
|
if (!closure) {
|
||||||
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -272,8 +251,7 @@ pyswig_funpack_setter_closure (PyObject *obj, PyObject *val, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN PyObject *
|
SWIGINTERN PyObject *
|
||||||
pyswig_static_getter_closure (PyObject *obj, void *closure)
|
pyswig_static_getter_closure(PyObject *obj, void *closure) {
|
||||||
{
|
|
||||||
if (!closure)
|
if (!closure)
|
||||||
return SWIG_Py_Void();
|
return SWIG_Py_Void();
|
||||||
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
SwigPyGetSet *getset = (SwigPyGetSet *)closure;
|
||||||
|
|
@ -287,8 +265,7 @@ pyswig_static_getter_closure (PyObject *obj, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
pyswig_static_setter_closure (PyObject *obj, PyObject *val, void *closure)
|
pyswig_static_setter_closure(PyObject *obj, PyObject *val, void *closure) {
|
||||||
{
|
|
||||||
if (!closure) {
|
if (!closure) {
|
||||||
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
PyErr_Format(PyExc_TypeError, "Missing getset closure");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -309,8 +286,7 @@ pyswig_static_setter_closure (PyObject *obj, PyObject *val, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN void
|
SWIGINTERN void
|
||||||
SwigPyStaticVar_dealloc(PyDescrObject *descr)
|
SwigPyStaticVar_dealloc(PyDescrObject *descr) {
|
||||||
{
|
|
||||||
_PyObject_GC_UNTRACK(descr);
|
_PyObject_GC_UNTRACK(descr);
|
||||||
Py_XDECREF(descr->d_type);
|
Py_XDECREF(descr->d_type);
|
||||||
Py_XDECREF(descr->d_name);
|
Py_XDECREF(descr->d_name);
|
||||||
|
|
@ -318,61 +294,43 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN PyObject *
|
SWIGINTERN PyObject *
|
||||||
SwigPyStaticVar_repr(PyGetSetDescrObject *descr)
|
SwigPyStaticVar_repr(PyGetSetDescrObject *descr) {
|
||||||
{
|
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
return PyUnicode_FromFormat
|
return PyUnicode_FromFormat("<class attribute '%U' of type '%s'>", descr->d_name, descr->d_type->tp_name);
|
||||||
("<class attribute '%U' of type '%s'>",
|
|
||||||
descr->d_name, descr->d_type->tp_name);
|
|
||||||
#else
|
#else
|
||||||
return PyString_FromFormat
|
return PyString_FromFormat("<class attribute '%s' of type '%s'>", PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
||||||
("<class attribute '%s' of type '%s'>",
|
|
||||||
PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg)
|
SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) {
|
||||||
{
|
|
||||||
PyDescrObject *descr = (PyDescrObject *)self;
|
PyDescrObject *descr = (PyDescrObject *)self;
|
||||||
Py_VISIT(descr->d_type);
|
Py_VISIT(descr->d_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN PyObject *
|
SWIGINTERN PyObject *
|
||||||
SwigPyStaticVar_get (PyGetSetDescrObject *descr, PyObject *obj, PyObject *type)
|
SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *type) {
|
||||||
{
|
|
||||||
if (descr->d_getset->get != NULL)
|
if (descr->d_getset->get != NULL)
|
||||||
return descr->d_getset->get(obj, descr->d_getset->closure);
|
return descr->d_getset->get(obj, descr->d_getset->closure);
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "attribute '%.300U' of '%.100s' objects is not readable", descr->d_name, descr->d_type->tp_name);
|
||||||
"attribute '%.300U' of '%.100s' objects is not readable",
|
|
||||||
descr->d_name, descr->d_type->tp_name);
|
|
||||||
#else
|
#else
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
||||||
"attribute '%.300s' of '%.100s' objects is not readable",
|
|
||||||
PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SwigPyStaticVar_set (PyGetSetDescrObject *descr, PyObject *obj, PyObject *value)
|
SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) {
|
||||||
{
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (descr->d_getset->set != NULL)
|
if (descr->d_getset->set != NULL)
|
||||||
return descr->d_getset->set(obj, value, descr->d_getset->closure);
|
return descr->d_getset->set(obj, value, descr->d_getset->closure);
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "attribute '%.300U' of '%.100s' objects is not writable", descr->d_name, descr->d_type->tp_name);
|
||||||
"attribute '%.300U' of '%.100s' objects is not writable",
|
|
||||||
descr->d_name,
|
|
||||||
descr->d_type->tp_name);
|
|
||||||
#else
|
#else
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
||||||
"attribute '%.300s' of '%.100s' objects is not writable",
|
|
||||||
PyString_AsString(descr->d_name),
|
|
||||||
descr->d_type->tp_name);
|
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -420,8 +378,7 @@ SWIGINTERN PyTypeObject SwigPyStaticVar_Type = {
|
||||||
};
|
};
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value)
|
SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) {
|
||||||
{
|
|
||||||
PyObject *attribute = _PyType_Lookup(type, name);
|
PyObject *attribute = _PyType_Lookup(type, name);
|
||||||
if (attribute != NULL) {
|
if (attribute != NULL) {
|
||||||
/* Implement descriptor functionality, if any */
|
/* Implement descriptor functionality, if any */
|
||||||
|
|
@ -429,23 +386,15 @@ SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value)
|
||||||
if (local_set != NULL)
|
if (local_set != NULL)
|
||||||
return local_set(attribute, (PyObject *)type, value);
|
return local_set(attribute, (PyObject *)type, value);
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400U'", type->tp_name, name);
|
||||||
"cannot modify read-only attribute '%.50s.%.400U'",
|
|
||||||
type->tp_name, name);
|
|
||||||
#else
|
#else
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400s'", type->tp_name, PyString_AS_STRING(name));
|
||||||
"cannot modify read-only attribute '%.50s.%.400s'",
|
|
||||||
type->tp_name, PyString_AS_STRING(name));
|
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400U'", type->tp_name, name);
|
||||||
"type '%.50s' has no attribute '%.400U'",
|
|
||||||
type->tp_name, name);
|
|
||||||
#else
|
#else
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name));
|
||||||
"type '%.50s' has no attribute '%.400s'",
|
|
||||||
type->tp_name, PyString_AS_STRING(name));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -453,8 +402,7 @@ SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN PyGetSetDescrObject *
|
SWIGINTERN PyGetSetDescrObject *
|
||||||
SwigPyStaticVar_new_getset (PyTypeObject *type, PyGetSetDef *getset)
|
SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {
|
||||||
{
|
|
||||||
PyGetSetDescrObject *descr = (PyGetSetDescrObject *)PyType_GenericAlloc(&SwigPyStaticVar_Type, 0);
|
PyGetSetDescrObject *descr = (PyGetSetDescrObject *)PyType_GenericAlloc(&SwigPyStaticVar_Type, 0);
|
||||||
assert(descr);
|
assert(descr);
|
||||||
Py_XINCREF(type);
|
Py_XINCREF(type);
|
||||||
|
|
@ -473,8 +421,7 @@ SwigPyStaticVar_new_getset (PyTypeObject *type, PyGetSetDef *getset)
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
SWIGINTERN void
|
SWIGINTERN void
|
||||||
pyswig_builtin_init_bases (PyTypeObject *type, std::vector<PyTypeObject*>& bases)
|
pyswig_builtin_init_bases(PyTypeObject *type, std::vector<PyTypeObject *> &bases) {
|
||||||
{
|
|
||||||
if (!bases.size())
|
if (!bases.size())
|
||||||
bases.push_back(SwigPyObject_type());
|
bases.push_back(SwigPyObject_type());
|
||||||
type->tp_base = bases[0];
|
type->tp_base = bases[0];
|
||||||
|
|
@ -489,8 +436,7 @@ pyswig_builtin_init_bases (PyTypeObject *type, std::vector<PyTypeObject*>& bases
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERN PyObject *
|
SWIGINTERN PyObject *
|
||||||
pyswig_this_closure (PyObject *self, void *closure)
|
pyswig_this_closure(PyObject *self, void *closure) {
|
||||||
{
|
|
||||||
PyObject *result = (PyObject *)SWIG_Python_GetSwigThis(self);
|
PyObject *result = (PyObject *)SWIG_Python_GetSwigThis(self);
|
||||||
Py_XINCREF(result);
|
Py_XINCREF(result);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,8 @@ namespace Swig {
|
||||||
SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
||||||
sobj->own = 0;
|
sobj->own = 0;
|
||||||
Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<_Tp *>(sobj->ptr));
|
Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<_Tp *>(sobj->ptr));
|
||||||
if (d) d->swig_disown();
|
if (d)
|
||||||
|
d->swig_disown();
|
||||||
return PyWeakref_NewProxy(pyobj, NULL);
|
return PyWeakref_NewProxy(pyobj, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -338,8 +338,7 @@ SwigPyClientData_New(PyObject* obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME void
|
SWIGRUNTIME void
|
||||||
SwigPyClientData_Del(SwigPyClientData* data)
|
SwigPyClientData_Del(SwigPyClientData *data) {
|
||||||
{
|
|
||||||
Py_XDECREF(data->newraw);
|
Py_XDECREF(data->newraw);
|
||||||
Py_XDECREF(data->newargs);
|
Py_XDECREF(data->newargs);
|
||||||
Py_XDECREF(data->destroy);
|
Py_XDECREF(data->destroy);
|
||||||
|
|
@ -1127,28 +1126,6 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
|
||||||
return SWIG_OK;
|
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;
|
int res = SWIG_ERROR;
|
||||||
|
|
||||||
SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
|
SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
|
||||||
|
|
@ -1696,8 +1673,7 @@ 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
|
// Cribbed from Objects/object.c in the python source code and modified
|
||||||
SWIGRUNTIME int
|
SWIGRUNTIME int
|
||||||
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value)
|
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
|
||||||
{
|
|
||||||
PyTypeObject *tp = obj->ob_type;
|
PyTypeObject *tp = obj->ob_type;
|
||||||
PyObject *descr;
|
PyObject *descr;
|
||||||
descrsetfunc f;
|
descrsetfunc f;
|
||||||
|
|
@ -1706,21 +1682,19 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value)
|
||||||
#ifdef Py_USING_UNICODE
|
#ifdef Py_USING_UNICODE
|
||||||
if (PyString_Check(name)) {
|
if (PyString_Check(name)) {
|
||||||
name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
|
name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
|
||||||
if (name == NULL)
|
if (!name)
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!PyUnicode_Check(name)) {
|
} else if (!PyUnicode_Check(name)) {
|
||||||
#else
|
#else
|
||||||
if (!PyString_Check(name)) {
|
if (!PyString_Check(name)) {
|
||||||
#endif
|
#endif
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
|
||||||
"attribute name must be string, not '%.200s'",
|
|
||||||
name->ob_type->tp_name);
|
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
Py_INCREF(name);
|
Py_INCREF(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tp->tp_dict == NULL) {
|
if (!tp->tp_dict) {
|
||||||
if (PyType_Ready(tp) < 0)
|
if (PyType_Ready(tp) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
@ -1729,7 +1703,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value)
|
||||||
f = NULL;
|
f = NULL;
|
||||||
if (descr != NULL)
|
if (descr != NULL)
|
||||||
f = descr->ob_type->tp_descr_set;
|
f = descr->ob_type->tp_descr_set;
|
||||||
if (f == NULL) {
|
if (!f) {
|
||||||
PyErr_Format(PyExc_AttributeError,
|
PyErr_Format(PyExc_AttributeError,
|
||||||
#ifdef Py_USING_UNICODE
|
#ifdef Py_USING_UNICODE
|
||||||
"'%.100s' object has no attribute '%.200U'",
|
"'%.100s' object has no attribute '%.200U'",
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,4 @@
|
||||||
%insert(runtime) "pythreads.swg"; /* Python thread code */
|
%insert(runtime) "pythreads.swg"; /* Python thread code */
|
||||||
%insert(runtime) "pyapi.swg"; /* Python API */
|
%insert(runtime) "pyapi.swg"; /* Python API */
|
||||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||||
|
|
||||||
%insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */
|
%insert(runtime) "builtin.swg"; /* Specialization for classes with single inheritance */
|
||||||
|
|
|
||||||
|
|
@ -240,9 +240,11 @@ public:
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
* Thread Implementation
|
* Thread Implementation
|
||||||
* ------------------------------------------------------------ */ int threads_enable(Node *n) const {
|
* ------------------------------------------------------------ */
|
||||||
|
int threads_enable(Node *n) const {
|
||||||
return threads && !GetFlagAttr(n, "feature:nothread");
|
return threads && !GetFlagAttr(n, "feature:nothread");
|
||||||
}
|
}
|
||||||
|
|
||||||
int initialize_threads(String *f_init) {
|
int initialize_threads(String *f_init) {
|
||||||
if (!threads) {
|
if (!threads) {
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
@ -510,7 +512,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} /* for */
|
}
|
||||||
|
|
||||||
if (py3) {
|
if (py3) {
|
||||||
/* force disable features that not compatible with Python 3.x */
|
/* force disable features that not compatible with Python 3.x */
|
||||||
|
|
@ -995,8 +997,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Dump(f_wrappers, f_begin);
|
Dump(f_wrappers, f_begin);
|
||||||
//if (builtin)
|
|
||||||
//Dump(f_builtins, f_begin);
|
|
||||||
Wrapper_pretty_print(f_init, f_begin);
|
Wrapper_pretty_print(f_init, f_begin);
|
||||||
|
|
||||||
Delete(f_header);
|
Delete(f_header);
|
||||||
|
|
@ -3278,8 +3278,7 @@ public:
|
||||||
Hash *richcompare = Getattr(n, "richcompare");
|
Hash *richcompare = Getattr(n, "richcompare");
|
||||||
assert(richcompare);
|
assert(richcompare);
|
||||||
Printf(f, "SWIGINTERN PyObject *\n");
|
Printf(f, "SWIGINTERN PyObject *\n");
|
||||||
Printf(f, "%s_richcompare (PyObject *self, PyObject *other, int op)\n", templ);
|
Printf(f, "%s_richcompare(PyObject *self, PyObject *other, int op) {\n", templ);
|
||||||
Printf(f, "{\n");
|
|
||||||
Printf(f, " PyObject *result = NULL;\n");
|
Printf(f, " PyObject *result = NULL;\n");
|
||||||
if (!funpack) {
|
if (!funpack) {
|
||||||
Printf(f, " PyObject *tuple = PyTuple_New(1);\n");
|
Printf(f, " PyObject *tuple = PyTuple_New(1);\n");
|
||||||
|
|
@ -3292,7 +3291,7 @@ public:
|
||||||
Printf(f, " case %s : result = %s(self, %s); break;\n", i.key, i.item, funpack ? "other" : "tuple");
|
Printf(f, " case %s : result = %s(self, %s); break;\n", i.key, i.item, funpack ? "other" : "tuple");
|
||||||
Printv(f, " default : break;\n", NIL);
|
Printv(f, " default : break;\n", NIL);
|
||||||
Printf(f, " }\n");
|
Printf(f, " }\n");
|
||||||
Printv(f, " if (result == NULL) {\n", NIL);
|
Printv(f, " if (!result) {\n", NIL);
|
||||||
Printv(f, " if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) {\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, " result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op);\n", NIL);
|
||||||
Printv(f, " } else {\n", NIL);
|
Printv(f, " } else {\n", NIL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue