diff --git a/src/gphoto2/common/preamble.i b/src/gphoto2/common/preamble.i index 2372445..6a0fafa 100644 --- a/src/gphoto2/common/preamble.i +++ b/src/gphoto2/common/preamble.i @@ -70,7 +70,9 @@ PyObject *PyExc_GPhoto2Error = NULL; SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; diff --git a/src/swig-gp2_5_33/abilities_list.py b/src/swig-gp2_5_33/abilities_list.py index 1f5e1cd..667da03 100644 --- a/src/swig-gp2_5_33/abilities_list.py +++ b/src/swig-gp2_5_33/abilities_list.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. @@ -10,7 +10,7 @@ import gphoto2.port_info_list # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._abilities_list import * else: from _abilities_list import * diff --git a/src/swig-gp2_5_33/abilities_list_wrap.c b/src/swig-gp2_5_33/abilities_list_wrap.c index 29e9fe1..429f2a6 100644 --- a/src/swig-gp2_5_33/abilities_list_wrap.c +++ b/src/swig-gp2_5_33/abilities_list_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4029,9 +4377,6 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4131,6 +4476,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4279,7 +4627,7 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4294,7 +4642,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4321,7 +4669,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -4480,7 +4828,7 @@ SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { - if (size > INT_MAX) { + if (size > (size_t)PY_SSIZE_T_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); @@ -4539,7 +4887,7 @@ SWIGINTERN int _wrap_new_CameraAbilitiesList(PyObject *self, PyObject *args, PyO SWIGINTERN PyObject *_wrap_delete_CameraAbilitiesList(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4562,7 +4910,7 @@ SWIGINTERN PyObject *_wrap_delete_CameraAbilitiesList(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_CameraAbilitiesList___len__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -4586,9 +4934,9 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList___len__(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraAbilitiesList___getitem__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; int arg2 ; - CameraAbilities *arg3 = (CameraAbilities *) 0 ; + CameraAbilities *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -4637,8 +4985,8 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList___getitem__(PyObject *self, PyObj SWIGINTERN PyObject *_wrap_CameraAbilitiesList_load(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -4674,9 +5022,9 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList_load(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_CameraAbilitiesList_load_dir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; - char *arg2 = (char *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; + char *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4723,7 +5071,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList_load_dir(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraAbilitiesList_reset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4746,10 +5094,10 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList_reset(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_CameraAbilitiesList_detect(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; - GPPortInfoList *arg2 = (GPPortInfoList *) 0 ; - CameraList *arg3 = (CameraList *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; + GPPortInfoList *arg2 = 0 ; + CameraList *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -4818,7 +5166,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList_detect(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_CameraAbilitiesList_append(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; CameraAbilities arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4860,7 +5208,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList_append(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_CameraAbilitiesList_count(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -4884,8 +5232,8 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList_count(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_CameraAbilitiesList_lookup_model(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4920,9 +5268,9 @@ SWIGINTERN PyObject *_wrap_CameraAbilitiesList_lookup_model(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraAbilitiesList_get_abilities(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraAbilitiesList *arg1 = (struct _CameraAbilitiesList *) 0 ; + struct _CameraAbilitiesList *arg1 = 0 ; int arg2 ; - CameraAbilities *arg3 = (CameraAbilities *) 0 ; + CameraAbilities *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -4977,7 +5325,7 @@ SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_CameraAbilitiesList___getitem__) /* defines _w SWIGINTERN PyObject *_wrap_CameraAbilities_model_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5004,7 +5352,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_model_get(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_CameraAbilities_status_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraDriverStatus result; @@ -5025,7 +5373,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_status_get(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_CameraAbilities_port_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GPPortType result; @@ -5046,7 +5394,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_port_get(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_CameraAbilities_speed_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int *result = 0 ; @@ -5076,7 +5424,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_speed_get(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_CameraAbilities_operations_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraOperation result; @@ -5097,7 +5445,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_operations_get(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraAbilities_file_operations_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileOperation result; @@ -5118,7 +5466,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_file_operations_get(PyObject *self, P SWIGINTERN PyObject *_wrap_CameraAbilities_folder_operations_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFolderOperation result; @@ -5139,7 +5487,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_folder_operations_get(PyObject *self, SWIGINTERN PyObject *_wrap_CameraAbilities_usb_vendor_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5160,7 +5508,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_usb_vendor_get(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraAbilities_usb_product_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5181,7 +5529,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_usb_product_get(PyObject *self, PyObj SWIGINTERN PyObject *_wrap_CameraAbilities_usb_class_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5202,7 +5550,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_usb_class_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraAbilities_usb_subclass_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5223,7 +5571,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_usb_subclass_get(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraAbilities_usb_protocol_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5244,7 +5592,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_usb_protocol_get(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraAbilities_library_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5271,7 +5619,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_library_get(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraAbilities_id_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5298,7 +5646,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_id_get(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraAbilities_device_type_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GphotoDeviceType result; @@ -5319,7 +5667,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_device_type_get(PyObject *self, PyObj SWIGINTERN PyObject *_wrap_CameraAbilities_reserved2_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5340,7 +5688,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_reserved2_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraAbilities_reserved3_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5361,7 +5709,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_reserved3_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraAbilities_reserved4_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5382,7 +5730,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_reserved4_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraAbilities_reserved5_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5403,7 +5751,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_reserved5_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraAbilities_reserved6_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5424,7 +5772,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_reserved6_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraAbilities_reserved7_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5445,7 +5793,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_reserved7_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraAbilities_reserved8_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5466,7 +5814,7 @@ SWIGINTERN PyObject *_wrap_CameraAbilities_reserved8_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_delete_CameraAbilities(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilities *arg1 = (CameraAbilities *) 0 ; + CameraAbilities *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5488,7 +5836,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CameraAbilities) /* defines _wrap_delete_ SWIGINTERN PyObject *_wrap_gp_abilities_list_new(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList **arg1 = (CameraAbilitiesList **) 0 ; + CameraAbilitiesList **arg1 = 0 ; CameraAbilitiesList *temp1 ; int result; @@ -5511,8 +5859,8 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_new(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_abilities_list_load(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + CameraAbilitiesList *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5547,9 +5895,9 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_load(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_gp_abilities_list_load_dir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; - char *arg2 = (char *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + CameraAbilitiesList *arg1 = 0 ; + char *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5595,7 +5943,7 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_load_dir(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_gp_abilities_list_reset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; + CameraAbilitiesList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5617,10 +5965,10 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_reset(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_abilities_list_detect(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; - GPPortInfoList *arg2 = (GPPortInfoList *) 0 ; - CameraList *arg3 = (CameraList *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + CameraAbilitiesList *arg1 = 0 ; + GPPortInfoList *arg2 = 0 ; + CameraList *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5688,7 +6036,7 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_detect(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_abilities_list_append(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; + CameraAbilitiesList *arg1 = 0 ; CameraAbilities arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5732,7 +6080,7 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_append(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_abilities_list_count(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; + CameraAbilitiesList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5754,8 +6102,8 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_count(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_abilities_list_lookup_model(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; - char *arg2 = (char *) 0 ; + CameraAbilitiesList *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5788,9 +6136,9 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_lookup_model(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_gp_abilities_list_get_abilities(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraAbilitiesList *arg1 = (CameraAbilitiesList *) 0 ; + CameraAbilitiesList *arg1 = 0 ; int arg2 ; - CameraAbilities *arg3 = (CameraAbilities *) 0 ; + CameraAbilities *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5838,7 +6186,7 @@ SWIGINTERN PyObject *_wrap_gp_abilities_list_get_abilities(PyObject *self, PyObj SWIGINTERN PyObject *_wrap_gp_message_codeset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; + char *arg1 = 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; @@ -5863,7 +6211,7 @@ SWIGINTERN PyObject *_wrap_gp_message_codeset(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_init_localedir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; + char *arg1 = 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; @@ -6130,7 +6478,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet CameraAbilitiesList___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraAbilitiesList_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"_CameraAbilitiesList", &CameraAbilitiesList___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraAbilitiesList___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -6143,7 +6491,7 @@ SwigPyBuiltin___CameraAbilitiesList_richcompare(PyObject *self, PyObject *other, SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6370,7 +6718,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraAbilitiesList_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_CameraAbilitiesList, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6519,6 +6867,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraAbilitiesList_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6542,7 +6893,6 @@ static PyTypeObject *SwigPyBuiltin___CameraAbilitiesList_type_create(PyTypeObjec SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraAbilitiesList'."); return NULL; } return pytype; @@ -6550,78 +6900,16 @@ static PyTypeObject *SwigPyBuiltin___CameraAbilitiesList_type_create(PyTypeObjec #else static PyTypeObject *SwigPyBuiltin___CameraAbilitiesList_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_CameraAbilitiesList }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraAbilitiesList_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_CameraAbilitiesList }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraAbilitiesList_destructor_closure }, { Py_tp_doc, (void *)"::_CameraAbilitiesList" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraAbilitiesList_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraAbilitiesList_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraAbilitiesList_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraAbilitiesList_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)_wrap_CameraAbilitiesList___len___lenfunc_closure }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)_wrap_CameraAbilitiesList___getitem___ssizeargfunc_closure }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, + { Py_sq_length, (void *)(lenfunc) _wrap_CameraAbilitiesList___len___lenfunc_closure }, + { Py_sq_item, (void *)(ssizeargfunc) _wrap_CameraAbilitiesList___getitem___ssizeargfunc_closure }, { 0, NULL } }; PyType_Spec spec = { @@ -6632,10 +6920,15 @@ static PyTypeObject *SwigPyBuiltin___CameraAbilitiesList_type_create(PyTypeObjec slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6673,7 +6966,7 @@ SWIGINTERN PyGetSetDef SwigPyBuiltin__CameraAbilities_getset[] = { { (char *)"port", SwigPyBuiltin_GetterClosure, 0, (char *)"port", &CameraAbilities_port_getset }, { (char *)"speed", SwigPyBuiltin_GetterClosure, 0, (char *)"speed", &CameraAbilities_speed_getset }, { (char *)"reserved4", SwigPyBuiltin_GetterClosure, 0, (char *)"reserved4", &CameraAbilities_reserved4_getset }, - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"model", &CameraAbilities___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraAbilities___dict___getset }, { (char *)"reserved5", SwigPyBuiltin_GetterClosure, 0, (char *)"reserved5", &CameraAbilities_reserved5_getset }, { (char *)"model", SwigPyBuiltin_GetterClosure, 0, (char *)"model", &CameraAbilities_model_getset }, { (char *)"reserved6", SwigPyBuiltin_GetterClosure, 0, (char *)"reserved6", &CameraAbilities_reserved6_getset }, @@ -6701,7 +6994,7 @@ SwigPyBuiltin__CameraAbilities_richcompare(PyObject *self, PyObject *other, int SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6776,7 +7069,7 @@ static PyHeapTypeObject SwigPyBuiltin__CameraAbilities_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6925,6 +7218,9 @@ static PyHeapTypeObject SwigPyBuiltin__CameraAbilities_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6948,7 +7244,6 @@ static PyTypeObject *SwigPyBuiltin__CameraAbilities_type_create(PyTypeObject *ty SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraAbilities'."); return NULL; } return pytype; @@ -6956,17 +7251,9 @@ static PyTypeObject *SwigPyBuiltin__CameraAbilities_type_create(PyTypeObject *ty #else static PyTypeObject *SwigPyBuiltin__CameraAbilities_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraAbilities_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraAbilities_destructor_closure }, { Py_tp_doc, (void *)"\n" "Describes the properties of a specific camera. \n" "\n" @@ -6975,66 +7262,10 @@ static PyTypeObject *SwigPyBuiltin__CameraAbilities_type_create(PyTypeObject *ty "\n" "C++ includes: gphoto2-abilities-list.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin__CameraAbilities_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin__CameraAbilities_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin__CameraAbilities_methods }, { Py_tp_getset, (void *)SwigPyBuiltin__CameraAbilities_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -7045,10 +7276,15 @@ static PyTypeObject *SwigPyBuiltin__CameraAbilities_type_create(PyTypeObject *ty slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -7147,7 +7383,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -7162,15 +7398,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -7182,8 +7423,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -7201,6 +7505,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -7252,8 +7596,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -7279,48 +7624,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -7351,7 +7749,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -7359,13 +7756,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -7469,6 +7869,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -7480,21 +7882,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -7532,27 +7959,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -7571,19 +8002,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -7608,7 +8035,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -7624,15 +8053,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraAbilitiesList_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraAbilitiesList_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraAbilitiesList", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraAbilitiesList", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraAbilitiesList"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_DRIVER_STATUS_PRODUCTION",SWIG_From_int((int)(GP_DRIVER_STATUS_PRODUCTION))); @@ -7668,21 +8096,16 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin__CameraAbilities_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin__CameraAbilities_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraAbilities", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraAbilities", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraAbilities"); d = md; -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/camera.py b/src/swig-gp2_5_33/camera.py index c995d9e..e98d823 100644 --- a/src/swig-gp2_5_33/camera.py +++ b/src/swig-gp2_5_33/camera.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. @@ -14,7 +14,7 @@ import gphoto2.widget # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._camera import * else: from _camera import * diff --git a/src/swig-gp2_5_33/camera_wrap.c b/src/swig-gp2_5_33/camera_wrap.c index 4cc2780..f784a70 100644 --- a/src/swig-gp2_5_33/camera_wrap.c +++ b/src/swig-gp2_5_33/camera_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_THREADS #define SWIG_PYTHON_DIRECTOR_NO_VTABLE @@ -140,9 +140,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -206,14 +206,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -231,7 +223,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -429,8 +421,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -491,55 +483,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -602,20 +686,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -820,6 +908,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -847,6 +941,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -872,7 +976,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -882,6 +986,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -889,7 +995,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -897,7 +1003,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -924,6 +1030,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1150,8 +1340,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1202,7 +1392,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1253,8 +1442,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1379,7 +1591,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1388,7 +1600,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1427,7 +1639,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1439,7 +1651,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1457,7 +1669,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1474,13 +1686,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1492,30 +1700,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1546,37 +1754,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1740,9 +1961,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1753,11 +1973,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1830,7 +2050,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1838,26 +2058,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1866,7 +2093,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1876,7 +2103,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1884,29 +2111,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1968,9 +2195,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2037,7 +2262,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2049,7 +2274,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2105,7 +2330,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2132,14 +2357,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2182,46 +2407,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2277,30 +2525,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2315,19 +2565,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2338,7 +2588,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2354,7 +2604,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2404,10 +2654,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2416,24 +2669,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2479,10 +2736,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2493,18 +2751,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2519,13 +2777,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2535,7 +2791,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2876,17 +3132,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2954,6 +3208,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2964,7 +3224,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2972,27 +3232,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3006,10 +3271,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3017,13 +3282,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3084,49 +3346,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3140,7 +3359,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3156,7 +3375,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3170,7 +3395,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3180,7 +3405,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3231,7 +3464,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3239,7 +3478,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3282,12 +3527,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3305,12 +3566,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3329,7 +3606,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3349,9 +3625,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3361,9 +3637,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3372,26 +3648,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3399,7 +3680,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3410,7 +3693,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3433,7 +3716,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3483,17 +3766,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3504,7 +3821,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3527,7 +3844,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3577,13 +3894,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3611,7 +3957,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3633,12 +3979,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3666,7 +4012,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3680,7 +4028,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4069,9 +4417,6 @@ static swig_module_info swig_module = {swig_types, 56, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4111,7 +4456,7 @@ SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { - if (size > INT_MAX) { + if (size > (size_t)PY_SSIZE_T_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); @@ -4295,6 +4640,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4492,7 +4840,7 @@ PyErr_SetObject(PyExc_GPhoto2Error, PyInt_FromLong(result)); SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4507,7 +4855,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4534,7 +4882,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -5009,9 +5357,9 @@ extern "C" { #endif SWIGINTERN PyObject *_wrap_gp_camera_capture_preview(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraFile *arg2 = (CameraFile *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraFile *arg2 = 0 ; + GPContext *arg3 = 0 ; int new_file2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5094,7 +5442,7 @@ SWIGINTERN PyObject *_wrap_gp_camera_capture_preview(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_CameraText___str__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraText *arg1 = (CameraText *) 0 ; + CameraText *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5115,7 +5463,7 @@ SWIGINTERN PyObject *_wrap_CameraText___str__(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraText_text_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraText *arg1 = (CameraText *) 0 ; + CameraText *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5142,7 +5490,7 @@ SWIGINTERN PyObject *_wrap_CameraText_text_get(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_delete_CameraText(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraText *arg1 = (CameraText *) 0 ; + CameraText *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5166,7 +5514,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CameraText) /* defines _wrap_delete_Camer SWIGINTERN PyObject *_wrap_CameraFilePath_name_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFilePath *arg1 = (CameraFilePath *) 0 ; + CameraFilePath *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5193,7 +5541,7 @@ SWIGINTERN PyObject *_wrap_CameraFilePath_name_get(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_CameraFilePath_folder_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFilePath *arg1 = (CameraFilePath *) 0 ; + CameraFilePath *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5220,7 +5568,7 @@ SWIGINTERN PyObject *_wrap_CameraFilePath_folder_get(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_delete_CameraFilePath(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFilePath *arg1 = (CameraFilePath *) 0 ; + CameraFilePath *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5259,7 +5607,7 @@ SWIGINTERN int _wrap_new_Camera(PyObject *self, PyObject *args, PyObject *kwargs SWIGINTERN PyObject *_wrap_delete_Camera(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; + struct _Camera *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5282,8 +5630,8 @@ SWIGINTERN PyObject *_wrap_delete_Camera(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_autodetect(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + CameraList *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; @@ -5337,7 +5685,7 @@ SWIGINTERN PyObject *_wrap_Camera_autodetect(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_set_abilities(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; + struct _Camera *arg1 = 0 ; CameraAbilities arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5375,8 +5723,8 @@ SWIGINTERN PyObject *_wrap_Camera_set_abilities(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_get_abilities(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraAbilities *arg2 = (CameraAbilities *) 0 ; + struct _Camera *arg1 = 0 ; + CameraAbilities *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5417,8 +5765,8 @@ SWIGINTERN PyObject *_wrap_Camera_get_abilities(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_set_port_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - GPPortInfo arg2 = (GPPortInfo) 0 ; + struct _Camera *arg1 = 0 ; + GPPortInfo arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5449,8 +5797,8 @@ SWIGINTERN PyObject *_wrap_Camera_set_port_info(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_get_port_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - GPPortInfo *arg2 = (GPPortInfo *) 0 ; + struct _Camera *arg1 = 0 ; + GPPortInfo *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GPPortInfo temp2 ; @@ -5482,7 +5830,7 @@ SWIGINTERN PyObject *_wrap_Camera_get_port_info(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_set_port_speed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; + struct _Camera *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5514,7 +5862,7 @@ SWIGINTERN PyObject *_wrap_Camera_set_port_speed(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_get_port_speed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; + struct _Camera *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5538,8 +5886,8 @@ SWIGINTERN PyObject *_wrap_Camera_get_port_speed(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_init(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5575,8 +5923,8 @@ SWIGINTERN PyObject *_wrap_Camera_init(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_exit(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5612,9 +5960,9 @@ SWIGINTERN PyObject *_wrap_Camera_exit(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_get_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraWidget **arg2 = (CameraWidget **) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraWidget **arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidget *temp2 ; @@ -5660,9 +6008,9 @@ SWIGINTERN PyObject *_wrap_Camera_get_config(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_list_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraList *arg2 = (CameraList *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraList *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -5723,10 +6071,10 @@ SWIGINTERN PyObject *_wrap_Camera_list_config(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_get_single_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget **arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5783,9 +6131,9 @@ SWIGINTERN PyObject *_wrap_Camera_get_single_config(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_Camera_set_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraWidget *arg2 = (CameraWidget *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraWidget *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5829,10 +6177,10 @@ SWIGINTERN PyObject *_wrap_Camera_set_config(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_set_single_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget *arg3 = (CameraWidget *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5887,9 +6235,9 @@ SWIGINTERN PyObject *_wrap_Camera_set_single_config(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_Camera_get_summary(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraText *arg2 = (CameraText *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraText *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -5943,9 +6291,9 @@ SWIGINTERN PyObject *_wrap_Camera_get_summary(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_get_manual(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraText *arg2 = (CameraText *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraText *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -5999,9 +6347,9 @@ SWIGINTERN PyObject *_wrap_Camera_get_manual(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_get_about(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraText *arg2 = (CameraText *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraText *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -6055,10 +6403,10 @@ SWIGINTERN PyObject *_wrap_Camera_get_about(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_capture(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; + struct _Camera *arg1 = 0 ; CameraCaptureType arg2 ; - CameraFilePath *arg3 = (CameraFilePath *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + CameraFilePath *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -6120,8 +6468,8 @@ SWIGINTERN PyObject *_wrap_Camera_capture(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_trigger_capture(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -6157,9 +6505,9 @@ SWIGINTERN PyObject *_wrap_Camera_trigger_capture(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_Camera_capture_preview(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraFile *arg2 = (CameraFile *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraFile *arg2 = 0 ; + GPContext *arg3 = 0 ; int new_file2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -6239,11 +6587,11 @@ SWIGINTERN PyObject *_wrap_Camera_capture_preview(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_Camera_wait_for_event(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; + struct _Camera *arg1 = 0 ; int arg2 ; - CameraEventType *arg3 = (CameraEventType *) 0 ; - void **arg4 = (void **) 0 ; - GPContext *arg5 = (GPContext *) 0 ; + CameraEventType *arg3 = 0 ; + void **arg4 = 0 ; + GPContext *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -6313,10 +6661,10 @@ SWIGINTERN PyObject *_wrap_Camera_wait_for_event(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_get_storageinfo(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - CameraStorageInformation **arg2 = (CameraStorageInformation **) 0 ; - int *arg3 = (int *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + CameraStorageInformation **arg2 = 0 ; + int *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraStorageInformation *temp_ptr2 ; @@ -6384,10 +6732,10 @@ SWIGINTERN PyObject *_wrap_Camera_get_storageinfo(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_Camera_folder_list_files(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraList *arg3 = (CameraList *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraList *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6459,10 +6807,10 @@ SWIGINTERN PyObject *_wrap_Camera_folder_list_files(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_Camera_folder_list_folders(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraList *arg3 = (CameraList *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraList *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6534,9 +6882,9 @@ SWIGINTERN PyObject *_wrap_Camera_folder_list_folders(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_Camera_folder_delete_all(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6583,12 +6931,12 @@ SWIGINTERN PyObject *_wrap_Camera_folder_delete_all(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_Camera_folder_put_file(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileType arg4 ; - CameraFile *arg5 = (CameraFile *) 0 ; - GPContext *arg6 = (GPContext *) 0 ; + CameraFile *arg5 = 0 ; + GPContext *arg6 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6662,10 +7010,10 @@ SWIGINTERN PyObject *_wrap_Camera_folder_put_file(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_Camera_folder_make_dir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6723,10 +7071,10 @@ SWIGINTERN PyObject *_wrap_Camera_folder_make_dir(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_Camera_folder_remove_dir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6784,11 +7132,11 @@ SWIGINTERN PyObject *_wrap_Camera_folder_remove_dir(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_Camera_file_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - CameraFileInfo *arg4 = (CameraFileInfo *) 0 ; - GPContext *arg5 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + CameraFileInfo *arg4 = 0 ; + GPContext *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6864,11 +7212,11 @@ SWIGINTERN PyObject *_wrap_Camera_file_get_info(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_file_set_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileInfo arg4 ; - GPContext *arg5 = (GPContext *) 0 ; + GPContext *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6940,12 +7288,12 @@ SWIGINTERN PyObject *_wrap_Camera_file_set_info(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_Camera_file_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileType arg4 ; - CameraFile *arg5 = (CameraFile *) 0 ; - GPContext *arg6 = (GPContext *) 0 ; + CameraFile *arg5 = 0 ; + GPContext *arg6 = 0 ; int new_file5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -7055,14 +7403,14 @@ SWIGINTERN PyObject *_wrap_Camera_file_get(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_file_read(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileType arg4 ; uint64_t arg5 ; - char *arg6 = (char *) 0 ; - uint64_t *arg7 = (uint64_t *) 0 ; - GPContext *arg8 = (GPContext *) 0 ; + char *arg6 = 0 ; + uint64_t *arg7 = 0 ; + GPContext *arg8 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -7160,10 +7508,10 @@ SWIGINTERN PyObject *_wrap_Camera_file_read(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_Camera_file_delete(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _Camera *arg1 = (struct _Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + struct _Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -7223,7 +7571,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_Camera) /* defines _wrap_delete_Camera_de SWIGINTERN PyObject *_wrap_gp_camera_new(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera **arg1 = (Camera **) 0 ; + Camera **arg1 = 0 ; Camera *temp1 ; int result; @@ -7246,7 +7594,7 @@ SWIGINTERN PyObject *_wrap_gp_camera_new(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_camera_set_abilities(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; + Camera *arg1 = 0 ; CameraAbilities arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -7283,8 +7631,8 @@ SWIGINTERN PyObject *_wrap_gp_camera_set_abilities(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_camera_get_abilities(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraAbilities *arg2 = (CameraAbilities *) 0 ; + Camera *arg1 = 0 ; + CameraAbilities *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -7324,8 +7672,8 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_abilities(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_camera_set_port_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - GPPortInfo arg2 = (GPPortInfo) 0 ; + Camera *arg1 = 0 ; + GPPortInfo arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -7355,8 +7703,8 @@ SWIGINTERN PyObject *_wrap_gp_camera_set_port_info(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_camera_get_port_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - GPPortInfo *arg2 = (GPPortInfo *) 0 ; + Camera *arg1 = 0 ; + GPPortInfo *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GPPortInfo temp2 ; @@ -7387,7 +7735,7 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_port_info(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_camera_set_port_speed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; + Camera *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -7418,7 +7766,7 @@ SWIGINTERN PyObject *_wrap_gp_camera_set_port_speed(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_camera_get_port_speed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; + Camera *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -7440,8 +7788,8 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_port_speed(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_camera_autodetect(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + CameraList *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObject * obj0 = 0 ; @@ -7493,8 +7841,8 @@ SWIGINTERN PyObject *_wrap_gp_camera_autodetect(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_camera_init(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -7533,8 +7881,8 @@ SWIGINTERN PyObject *_wrap_gp_camera_init(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_camera_exit(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -7569,9 +7917,9 @@ SWIGINTERN PyObject *_wrap_gp_camera_exit(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_camera_get_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraWidget **arg2 = (CameraWidget **) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraWidget **arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidget *temp2 ; @@ -7620,9 +7968,9 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_config(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_camera_list_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraList *arg2 = (CameraList *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraList *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -7682,10 +8030,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_list_config(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_camera_get_single_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget **arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -7745,9 +8093,9 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_single_config(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_camera_set_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraWidget *arg2 = (CameraWidget *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraWidget *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -7794,10 +8142,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_set_config(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_camera_set_single_config(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget *arg3 = (CameraWidget *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -7855,9 +8203,9 @@ SWIGINTERN PyObject *_wrap_gp_camera_set_single_config(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_camera_get_summary(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraText *arg2 = (CameraText *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraText *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -7910,9 +8258,9 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_summary(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_camera_get_manual(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraText *arg2 = (CameraText *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraText *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -7965,9 +8313,9 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_manual(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_camera_get_about(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraText *arg2 = (CameraText *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraText *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp3 = 0 ; @@ -8020,10 +8368,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_about(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_camera_capture(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; + Camera *arg1 = 0 ; CameraCaptureType arg2 ; - CameraFilePath *arg3 = (CameraFilePath *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + CameraFilePath *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -8088,8 +8436,8 @@ SWIGINTERN PyObject *_wrap_gp_camera_capture(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_camera_trigger_capture(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - GPContext *arg2 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + GPContext *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -8128,11 +8476,11 @@ SWIGINTERN PyObject *_wrap_gp_camera_trigger_capture(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_camera_wait_for_event(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; + Camera *arg1 = 0 ; int arg2 ; - CameraEventType *arg3 = (CameraEventType *) 0 ; - void **arg4 = (void **) 0 ; - GPContext *arg5 = (GPContext *) 0 ; + CameraEventType *arg3 = 0 ; + void **arg4 = 0 ; + GPContext *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -8205,10 +8553,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_wait_for_event(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_camera_get_storageinfo(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - CameraStorageInformation **arg2 = (CameraStorageInformation **) 0 ; - int *arg3 = (int *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + CameraStorageInformation **arg2 = 0 ; + int *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraStorageInformation *temp_ptr2 ; @@ -8275,10 +8623,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_get_storageinfo(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_camera_folder_list_files(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraList *arg3 = (CameraList *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraList *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8353,10 +8701,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_folder_list_files(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_camera_folder_list_folders(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - CameraList *arg3 = (CameraList *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + CameraList *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8431,9 +8779,9 @@ SWIGINTERN PyObject *_wrap_gp_camera_folder_list_folders(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_gp_camera_folder_delete_all(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - GPContext *arg3 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + GPContext *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8483,12 +8831,12 @@ SWIGINTERN PyObject *_wrap_gp_camera_folder_delete_all(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_camera_folder_put_file(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileType arg4 ; - CameraFile *arg5 = (CameraFile *) 0 ; - GPContext *arg6 = (GPContext *) 0 ; + CameraFile *arg5 = 0 ; + GPContext *arg6 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8565,10 +8913,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_folder_put_file(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_camera_folder_make_dir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8625,10 +8973,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_folder_make_dir(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_camera_folder_remove_dir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8685,11 +9033,11 @@ SWIGINTERN PyObject *_wrap_gp_camera_folder_remove_dir(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_camera_file_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - CameraFileInfo *arg4 = (CameraFileInfo *) 0 ; - GPContext *arg5 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + CameraFileInfo *arg4 = 0 ; + GPContext *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8768,11 +9116,11 @@ SWIGINTERN PyObject *_wrap_gp_camera_file_get_info(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_camera_file_set_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileInfo arg4 ; - GPContext *arg5 = (GPContext *) 0 ; + GPContext *arg5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -8843,12 +9191,12 @@ SWIGINTERN PyObject *_wrap_gp_camera_file_set_info(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_camera_file_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileType arg4 ; - CameraFile *arg5 = (CameraFile *) 0 ; - GPContext *arg6 = (GPContext *) 0 ; + CameraFile *arg5 = 0 ; + GPContext *arg6 = 0 ; int new_file5 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -8961,14 +9309,14 @@ SWIGINTERN PyObject *_wrap_gp_camera_file_get(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_camera_file_read(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; CameraFileType arg4 ; uint64_t arg5 ; - char *arg6 = (char *) 0 ; - uint64_t *arg7 = (uint64_t *) 0 ; - GPContext *arg8 = (GPContext *) 0 ; + char *arg6 = 0 ; + uint64_t *arg7 = 0 ; + GPContext *arg8 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -9069,10 +9417,10 @@ SWIGINTERN PyObject *_wrap_gp_camera_file_read(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_camera_file_delete(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - Camera *arg1 = (Camera *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - GPContext *arg4 = (GPContext *) 0 ; + Camera *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; + GPContext *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -10074,29 +10422,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet CameraText___dict___getset = { SwigPyObject_get___dict__, 0 }; static SwigPyGetSet CameraText_text_getset = { _wrap_CameraText_text_get, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin__CameraText_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"\n" - "gp_camera_capture_preview\n" - "Captures a preview that won't be stored on the camera but returned in\n" - "supplied file. \n" - "\n" - "Parameters\n" - "----------\n" - "* `camera` : \n" - " a Camera \n" - "* `file` : \n" - " a CameraFile \n" - "* `context` : \n" - " a GPContext \n" - "\n" - "Returns\n" - "-------\n" - "a gphoto2 error code \n" - "\n" - "For example, you could use gp_capture_preview() for taking some sample\n" - "pictures before calling gp_capture().\n" - "\n" - "See also gphoto2.Camera.capture_preview\n" - "", &CameraText___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraText___dict___getset }, { (char *)"text", SwigPyBuiltin_GetterClosure, 0, (char *)"text", &CameraText_text_getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -10110,7 +10436,7 @@ SwigPyBuiltin__CameraText_richcompare(PyObject *self, PyObject *other, int op) { SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -10186,7 +10512,7 @@ static PyHeapTypeObject SwigPyBuiltin__CameraText_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -10335,6 +10661,9 @@ static PyHeapTypeObject SwigPyBuiltin__CameraText_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -10358,7 +10687,6 @@ static PyTypeObject *SwigPyBuiltin__CameraText_type_create(PyTypeObject *type, P SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraText'."); return NULL; } return pytype; @@ -10366,17 +10694,9 @@ static PyTypeObject *SwigPyBuiltin__CameraText_type_create(PyTypeObject *type, P #else static PyTypeObject *SwigPyBuiltin__CameraText_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraText_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraText_destructor_closure }, { Py_tp_doc, (void *)"\n" "CameraText structure used in various functions. \n" "\n" @@ -10385,66 +10705,11 @@ static PyTypeObject *SwigPyBuiltin__CameraText_type_create(PyTypeObject *type, P "\n" "C++ includes: gphoto2-camera.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)_wrap_CameraText___str___reprfunc_closure }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin__CameraText_richcompare }, + { Py_tp_str, (void *)(reprfunc) _wrap_CameraText___str___reprfunc_closure }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin__CameraText_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin__CameraText_methods }, { Py_tp_getset, (void *)SwigPyBuiltin__CameraText_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -10455,10 +10720,15 @@ static PyTypeObject *SwigPyBuiltin__CameraText_type_create(PyTypeObject *type, P slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -10471,7 +10741,7 @@ static SwigPyGetSet CameraFilePath___dict___getset = { SwigPyObject_get___dict__ SWIGINTERN PyGetSetDef SwigPyBuiltin__CameraFilePath_getset[] = { { (char *)"name", SwigPyBuiltin_GetterClosure, 0, (char *)"name", &CameraFilePath_name_getset }, { (char *)"folder", SwigPyBuiltin_GetterClosure, 0, (char *)"folder", &CameraFilePath_folder_getset }, - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"name", &CameraFilePath___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraFilePath___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -10484,7 +10754,7 @@ SwigPyBuiltin__CameraFilePath_richcompare(PyObject *self, PyObject *other, int o SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -10560,7 +10830,7 @@ static PyHeapTypeObject SwigPyBuiltin__CameraFilePath_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -10709,6 +10979,9 @@ static PyHeapTypeObject SwigPyBuiltin__CameraFilePath_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -10732,7 +11005,6 @@ static PyTypeObject *SwigPyBuiltin__CameraFilePath_type_create(PyTypeObject *typ SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraFilePath'."); return NULL; } return pytype; @@ -10740,17 +11012,9 @@ static PyTypeObject *SwigPyBuiltin__CameraFilePath_type_create(PyTypeObject *typ #else static PyTypeObject *SwigPyBuiltin__CameraFilePath_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraFilePath_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraFilePath_destructor_closure }, { Py_tp_doc, (void *)"\n" "A structure created by the capture operation. \n" "\n" @@ -10760,66 +11024,10 @@ static PyTypeObject *SwigPyBuiltin__CameraFilePath_type_create(PyTypeObject *typ "\n" "C++ includes: gphoto2-camera.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin__CameraFilePath_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin__CameraFilePath_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin__CameraFilePath_methods }, { Py_tp_getset, (void *)SwigPyBuiltin__CameraFilePath_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -10830,10 +11038,15 @@ static PyTypeObject *SwigPyBuiltin__CameraFilePath_type_create(PyTypeObject *typ slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -10842,7 +11055,7 @@ SWIGINTERN SwigPyClientData SwigPyBuiltin__CameraFilePath_clientdata = {0, 0, 0, static SwigPyGetSet Camera___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___Camera_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"_Camera", &Camera___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &Camera___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -10855,7 +11068,7 @@ SwigPyBuiltin___Camera_richcompare(PyObject *self, PyObject *other, int op) { SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -11802,7 +12015,7 @@ static PyHeapTypeObject SwigPyBuiltin___Camera_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_Camera, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -11951,6 +12164,9 @@ static PyHeapTypeObject SwigPyBuiltin___Camera_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -11974,7 +12190,6 @@ static PyTypeObject *SwigPyBuiltin___Camera_type_create(PyTypeObject *type, PyTy SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'Camera'."); return NULL; } return pytype; @@ -11982,78 +12197,14 @@ static PyTypeObject *SwigPyBuiltin___Camera_type_create(PyTypeObject *type, PyTy #else static PyTypeObject *SwigPyBuiltin___Camera_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_Camera }, - { Py_tp_dealloc, (void *)_wrap_delete_Camera_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_Camera }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_Camera_destructor_closure }, { Py_tp_doc, (void *)"::_Camera" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___Camera_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___Camera_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___Camera_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___Camera_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -12064,10 +12215,15 @@ static PyTypeObject *SwigPyBuiltin___Camera_type_create(PyTypeObject *type, PyTy slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -12322,7 +12478,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -12337,15 +12493,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -12357,8 +12518,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -12376,6 +12600,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -12427,8 +12691,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -12454,48 +12719,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -12526,7 +12844,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -12534,13 +12851,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -12644,6 +12964,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -12655,21 +12977,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -12707,27 +13054,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -12746,19 +13097,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -12783,7 +13130,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -12799,15 +13148,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin__CameraText_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin__CameraText_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraText", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraText", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraText"); d = md; @@ -12819,15 +13167,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin__CameraFilePath_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin__CameraFilePath_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraFilePath", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraFilePath", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraFilePath"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_CAPTURE_IMAGE",SWIG_From_int((int)(GP_CAPTURE_IMAGE))); @@ -12848,24 +13195,19 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___Camera_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___Camera_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "Camera", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "Camera", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "Camera"); d = md; /* Initialize threading */ SWIG_PYTHON_INITIALIZE_THREADS; -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/context.py b/src/swig-gp2_5_33/context.py index 4295991..57f3d02 100644 --- a/src/swig-gp2_5_33/context.py +++ b/src/swig-gp2_5_33/context.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._context import * else: from _context import * diff --git a/src/swig-gp2_5_33/context_wrap.c b/src/swig-gp2_5_33/context_wrap.c index 9d9e42e..6284977 100644 --- a/src/swig-gp2_5_33/context_wrap.c +++ b/src/swig-gp2_5_33/context_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4024,9 +4372,6 @@ static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4416,7 +4761,7 @@ extern "C" { #endif SWIGINTERN PyObject *_wrap_delete_CallbackDetails(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct CallbackDetails *arg1 = (struct CallbackDetails *) 0 ; + struct CallbackDetails *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4438,9 +4783,9 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CallbackDetails) /* defines _wrap_delete_ SWIGINTERN PyObject *_wrap_unset_progress_funcs(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextProgressStartFunc arg2 = (GPContextProgressStartFunc) 0 ; - void *arg3 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextProgressStartFunc arg2 = 0 ; + void *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res3 ; @@ -4488,7 +4833,7 @@ SWIGINTERN int _wrap_new_GPContext(PyObject *self, PyObject *args, PyObject *kwa SWIGINTERN PyObject *_wrap_delete_GPContext(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; + struct _GPContext *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4508,9 +4853,9 @@ SWIGINTERN PyObject *_wrap_delete_GPContext(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPContext_set_idle_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; - GPContextIdleFunc arg2 = (GPContextIdleFunc) 0 ; - void *arg3 = (void *) 0 ; + struct _GPContext *arg1 = 0 ; + GPContextIdleFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -4575,9 +4920,9 @@ SWIGINTERN PyObject *_wrap_GPContext_set_idle_func(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_GPContext_set_error_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; - GPContextErrorFunc arg2 = (GPContextErrorFunc) 0 ; - void *arg3 = (void *) 0 ; + struct _GPContext *arg1 = 0 ; + GPContextErrorFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -4642,9 +4987,9 @@ SWIGINTERN PyObject *_wrap_GPContext_set_error_func(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_GPContext_set_message_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; - GPContextMessageFunc arg2 = (GPContextMessageFunc) 0 ; - void *arg3 = (void *) 0 ; + struct _GPContext *arg1 = 0 ; + GPContextMessageFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -4709,9 +5054,9 @@ SWIGINTERN PyObject *_wrap_GPContext_set_message_func(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_GPContext_set_question_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; - GPContextQuestionFunc arg2 = (GPContextQuestionFunc) 0 ; - void *arg3 = (void *) 0 ; + struct _GPContext *arg1 = 0 ; + GPContextQuestionFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -4776,9 +5121,9 @@ SWIGINTERN PyObject *_wrap_GPContext_set_question_func(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_GPContext_set_cancel_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; - GPContextCancelFunc arg2 = (GPContextCancelFunc) 0 ; - void *arg3 = (void *) 0 ; + struct _GPContext *arg1 = 0 ; + GPContextCancelFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -4843,11 +5188,11 @@ SWIGINTERN PyObject *_wrap_GPContext_set_cancel_func(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_GPContext_set_progress_funcs(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; - GPContextProgressStartFunc arg2 = (GPContextProgressStartFunc) 0 ; - GPContextProgressUpdateFunc arg3 = (GPContextProgressUpdateFunc) 0 ; - GPContextProgressStopFunc arg4 = (GPContextProgressStopFunc) 0 ; - void *arg5 = (void *) 0 ; + struct _GPContext *arg1 = 0 ; + GPContextProgressStartFunc arg2 = 0 ; + GPContextProgressUpdateFunc arg3 = 0 ; + GPContextProgressStopFunc arg4 = 0 ; + void *arg5 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -4930,9 +5275,9 @@ SWIGINTERN PyObject *_wrap_GPContext_set_progress_funcs(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_GPContext_set_status_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPContext *arg1 = (struct _GPContext *) 0 ; - GPContextStatusFunc arg2 = (GPContextStatusFunc) 0 ; - void *arg3 = (void *) 0 ; + struct _GPContext *arg1 = 0 ; + GPContextStatusFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5012,9 +5357,9 @@ SWIGINTERN PyObject *_wrap_gp_context_new(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_context_set_idle_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextIdleFunc arg2 = (GPContextIdleFunc) 0 ; - void *arg3 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextIdleFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5080,11 +5425,11 @@ SWIGINTERN PyObject *_wrap_gp_context_set_idle_func(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_context_set_progress_funcs(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextProgressStartFunc arg2 = (GPContextProgressStartFunc) 0 ; - GPContextProgressUpdateFunc arg3 = (GPContextProgressUpdateFunc) 0 ; - GPContextProgressStopFunc arg4 = (GPContextProgressStopFunc) 0 ; - void *arg5 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextProgressStartFunc arg2 = 0 ; + GPContextProgressUpdateFunc arg3 = 0 ; + GPContextProgressStopFunc arg4 = 0 ; + void *arg5 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5168,9 +5513,9 @@ SWIGINTERN PyObject *_wrap_gp_context_set_progress_funcs(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_gp_context_set_error_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextErrorFunc arg2 = (GPContextErrorFunc) 0 ; - void *arg3 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextErrorFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5236,9 +5581,9 @@ SWIGINTERN PyObject *_wrap_gp_context_set_error_func(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_context_set_status_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextStatusFunc arg2 = (GPContextStatusFunc) 0 ; - void *arg3 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextStatusFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5304,9 +5649,9 @@ SWIGINTERN PyObject *_wrap_gp_context_set_status_func(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_gp_context_set_question_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextQuestionFunc arg2 = (GPContextQuestionFunc) 0 ; - void *arg3 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextQuestionFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5372,9 +5717,9 @@ SWIGINTERN PyObject *_wrap_gp_context_set_question_func(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_context_set_cancel_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextCancelFunc arg2 = (GPContextCancelFunc) 0 ; - void *arg3 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextCancelFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5440,9 +5785,9 @@ SWIGINTERN PyObject *_wrap_gp_context_set_cancel_func(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_gp_context_set_message_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPContext *arg1 = (GPContext *) 0 ; - GPContextMessageFunc arg2 = (GPContextMessageFunc) 0 ; - void *arg3 = (void *) 0 ; + GPContext *arg1 = 0 ; + GPContextMessageFunc arg2 = 0 ; + void *arg3 = 0 ; CallbackDetails *_global_callbacks ; void *argp1 = 0 ; int res1 = 0 ; @@ -5606,7 +5951,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet CallbackDetails___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin__CallbackDetails_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"~CallbackDetails", &CallbackDetails___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CallbackDetails___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -5619,7 +5964,7 @@ SwigPyBuiltin__CallbackDetails_richcompare(PyObject *self, PyObject *other, int SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -5687,7 +6032,7 @@ static PyHeapTypeObject SwigPyBuiltin__CallbackDetails_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -5836,6 +6181,9 @@ static PyHeapTypeObject SwigPyBuiltin__CallbackDetails_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -5859,7 +6207,6 @@ static PyTypeObject *SwigPyBuiltin__CallbackDetails_type_create(PyTypeObject *ty SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CallbackDetails'."); return NULL; } return pytype; @@ -5867,78 +6214,14 @@ static PyTypeObject *SwigPyBuiltin__CallbackDetails_type_create(PyTypeObject *ty #else static PyTypeObject *SwigPyBuiltin__CallbackDetails_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CallbackDetails_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CallbackDetails_destructor_closure }, { Py_tp_doc, (void *)"::CallbackDetails" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin__CallbackDetails_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin__CallbackDetails_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin__CallbackDetails_methods }, { Py_tp_getset, (void *)SwigPyBuiltin__CallbackDetails_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -5949,10 +6232,15 @@ static PyTypeObject *SwigPyBuiltin__CallbackDetails_type_create(PyTypeObject *ty slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -5961,7 +6249,7 @@ SWIGINTERN SwigPyClientData SwigPyBuiltin__CallbackDetails_clientdata = {0, 0, 0 static SwigPyGetSet GPContext___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___GPContext_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"unset_progress_funcs", &GPContext___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &GPContext___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -5974,7 +6262,7 @@ SwigPyBuiltin___GPContext_richcompare(PyObject *self, PyObject *other, int op) { SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6107,7 +6395,7 @@ static PyHeapTypeObject SwigPyBuiltin___GPContext_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_GPContext, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6256,6 +6544,9 @@ static PyHeapTypeObject SwigPyBuiltin___GPContext_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6279,7 +6570,6 @@ static PyTypeObject *SwigPyBuiltin___GPContext_type_create(PyTypeObject *type, P SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'GPContext'."); return NULL; } return pytype; @@ -6287,78 +6577,14 @@ static PyTypeObject *SwigPyBuiltin___GPContext_type_create(PyTypeObject *type, P #else static PyTypeObject *SwigPyBuiltin___GPContext_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_GPContext }, - { Py_tp_dealloc, (void *)_wrap_delete_GPContext_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_GPContext }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_GPContext_destructor_closure }, { Py_tp_doc, (void *)"::_GPContext" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___GPContext_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___GPContext_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___GPContext_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___GPContext_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -6369,10 +6595,15 @@ static PyTypeObject *SwigPyBuiltin___GPContext_type_create(PyTypeObject *type, P slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6451,7 +6682,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -6466,15 +6697,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -6486,8 +6722,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -6505,6 +6804,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -6556,8 +6895,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -6583,48 +6923,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -6655,7 +7048,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -6663,13 +7055,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -6773,6 +7168,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -6784,21 +7181,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -6836,27 +7258,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -6875,19 +7301,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -6912,7 +7334,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -6928,15 +7352,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin__CallbackDetails_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin__CallbackDetails_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CallbackDetails", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CallbackDetails", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CallbackDetails"); d = md; @@ -6948,23 +7371,18 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___GPContext_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___GPContext_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "GPContext", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "GPContext", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "GPContext"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_CONTEXT_FEEDBACK_OK",SWIG_From_int((int)(GP_CONTEXT_FEEDBACK_OK))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_CONTEXT_FEEDBACK_CANCEL",SWIG_From_int((int)(GP_CONTEXT_FEEDBACK_CANCEL))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/file.py b/src/swig-gp2_5_33/file.py index 9089358..6f100dc 100644 --- a/src/swig-gp2_5_33/file.py +++ b/src/swig-gp2_5_33/file.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._file import * else: from _file import * diff --git a/src/swig-gp2_5_33/file_wrap.c b/src/swig-gp2_5_33/file_wrap.c index 719342f..26d2c70 100644 --- a/src/swig-gp2_5_33/file_wrap.c +++ b/src/swig-gp2_5_33/file_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_THREADS #define SWIG_PYTHON_DIRECTOR_NO_VTABLE @@ -140,9 +140,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -206,14 +206,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -231,7 +223,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -429,8 +421,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -491,55 +483,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -602,20 +686,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -820,6 +908,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -847,6 +941,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -872,7 +976,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -882,6 +986,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -889,7 +995,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -897,7 +1003,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -924,6 +1030,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1150,8 +1340,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1202,7 +1392,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1253,8 +1442,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1379,7 +1591,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1388,7 +1600,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1427,7 +1639,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1439,7 +1651,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1457,7 +1669,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1474,13 +1686,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1492,30 +1700,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1546,37 +1754,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1740,9 +1961,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1753,11 +1973,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1830,7 +2050,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1838,26 +2058,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1866,7 +2093,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1876,7 +2103,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1884,29 +2111,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1968,9 +2195,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2037,7 +2262,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2049,7 +2274,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2105,7 +2330,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2132,14 +2357,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2182,46 +2407,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2277,30 +2525,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2315,19 +2565,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2338,7 +2588,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2354,7 +2604,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2404,10 +2654,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2416,24 +2669,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2479,10 +2736,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2493,18 +2751,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2519,13 +2777,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2535,7 +2791,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2876,17 +3132,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2954,6 +3208,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2964,7 +3224,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2972,27 +3232,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3006,10 +3271,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3017,13 +3282,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3084,49 +3346,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3140,7 +3359,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3156,7 +3375,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3170,7 +3395,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3180,7 +3405,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3231,7 +3464,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3239,7 +3478,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3282,12 +3527,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3305,12 +3566,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3329,7 +3606,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3349,9 +3625,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3361,9 +3637,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3372,26 +3648,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3399,7 +3680,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3410,7 +3693,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3433,7 +3716,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3483,17 +3766,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3504,7 +3821,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3527,7 +3844,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3577,13 +3894,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3611,7 +3957,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3633,12 +3979,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3666,7 +4012,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3680,7 +4028,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4023,9 +4371,6 @@ static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4103,6 +4448,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4230,7 +4578,7 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4245,7 +4593,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4272,7 +4620,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -4599,7 +4947,7 @@ SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { - if (size > INT_MAX) { + if (size > (size_t)PY_SSIZE_T_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); @@ -4655,7 +5003,7 @@ SWIGINTERN int _wrap_new_CameraFile__SWIG_0(PyObject *self, PyObject *args, PyOb SWIGINTERN PyObject *_wrap_delete_CameraFile(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; + struct _CameraFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4742,8 +5090,8 @@ SWIGINTERN int _wrap_new_CameraFile(PyObject *self, PyObject *args, PyObject *kw SWIGINTERN PyObject *_wrap_CameraFile_set_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4777,8 +5125,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_set_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraFile_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char **arg2 = (char **) 0 ; + struct _CameraFile *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -4810,8 +5158,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_get_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraFile_set_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4845,8 +5193,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_set_mime_type(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_CameraFile_get_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char **arg2 = (char **) 0 ; + struct _CameraFile *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -4878,7 +5226,7 @@ SWIGINTERN PyObject *_wrap_CameraFile_get_mime_type(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_CameraFile_set_mtime(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; + struct _CameraFile *arg1 = 0 ; time_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4910,8 +5258,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_set_mtime(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraFile_get_mtime(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - time_t *arg2 = (time_t *) 0 ; + struct _CameraFile *arg1 = 0 ; + time_t *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; time_t temp2 ; @@ -4943,7 +5291,7 @@ SWIGINTERN PyObject *_wrap_CameraFile_get_mtime(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraFile_detect_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; + struct _CameraFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4966,7 +5314,7 @@ SWIGINTERN PyObject *_wrap_CameraFile_detect_mime_type(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFile_adjust_name_for_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; + struct _CameraFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4989,10 +5337,10 @@ SWIGINTERN PyObject *_wrap_CameraFile_adjust_name_for_mime_type(PyObject *self, SWIGINTERN PyObject *_wrap_CameraFile_get_name_by_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraFile *arg1 = 0 ; + char *arg2 = 0 ; CameraFileType arg3 ; - char **arg4 = (char **) 0 ; + char **arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5043,8 +5391,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_get_name_by_type(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFile_set_data_and_size(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraFile *arg1 = 0 ; + char *arg2 = 0 ; unsigned long arg3 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5096,9 +5444,9 @@ SWIGINTERN PyObject *_wrap_CameraFile_set_data_and_size(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFile_get_data_and_size(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char **arg2 = (char **) 0 ; - unsigned long *arg3 = (unsigned long *) 0 ; + struct _CameraFile *arg1 = 0 ; + char **arg2 = 0 ; + unsigned long *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp_data2 = NULL ; @@ -5131,8 +5479,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_get_data_and_size(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFile_save(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5166,7 +5514,7 @@ SWIGINTERN PyObject *_wrap_CameraFile_save(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraFile_clean(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; + struct _CameraFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5189,8 +5537,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_clean(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraFile_copy(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - CameraFile *arg2 = (CameraFile *) 0 ; + struct _CameraFile *arg1 = 0 ; + CameraFile *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5221,8 +5569,8 @@ SWIGINTERN PyObject *_wrap_CameraFile_copy(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraFile_open(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFile *arg1 = (struct _CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5258,7 +5606,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CameraFile) /* defines _wrap_delete_Camer SWIGINTERN PyObject *_wrap_gp_file_new(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile **arg1 = (CameraFile **) 0 ; + CameraFile **arg1 = 0 ; CameraFile *temp1 ; int result; @@ -5281,7 +5629,7 @@ SWIGINTERN PyObject *_wrap_gp_file_new(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_new_from_fd(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile **arg1 = (CameraFile **) 0 ; + CameraFile **arg1 = 0 ; int arg2 ; CameraFile *temp1 ; int val2 ; @@ -5313,8 +5661,8 @@ SWIGINTERN PyObject *_wrap_gp_file_new_from_fd(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_set_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5347,8 +5695,8 @@ SWIGINTERN PyObject *_wrap_gp_file_set_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char **arg2 = (char **) 0 ; + CameraFile *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -5379,8 +5727,8 @@ SWIGINTERN PyObject *_wrap_gp_file_get_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_set_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5413,8 +5761,8 @@ SWIGINTERN PyObject *_wrap_gp_file_set_mime_type(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_file_get_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char **arg2 = (char **) 0 ; + CameraFile *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -5445,7 +5793,7 @@ SWIGINTERN PyObject *_wrap_gp_file_get_mime_type(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_file_set_mtime(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; + CameraFile *arg1 = 0 ; time_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5476,8 +5824,8 @@ SWIGINTERN PyObject *_wrap_gp_file_set_mtime(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_get_mtime(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - time_t *arg2 = (time_t *) 0 ; + CameraFile *arg1 = 0 ; + time_t *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; time_t temp2 ; @@ -5508,7 +5856,7 @@ SWIGINTERN PyObject *_wrap_gp_file_get_mtime(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_detect_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; + CameraFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5530,7 +5878,7 @@ SWIGINTERN PyObject *_wrap_gp_file_detect_mime_type(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_file_adjust_name_for_mime_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; + CameraFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5552,10 +5900,10 @@ SWIGINTERN PyObject *_wrap_gp_file_adjust_name_for_mime_type(PyObject *self, PyO SWIGINTERN PyObject *_wrap_gp_file_get_name_by_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + CameraFile *arg1 = 0 ; + char *arg2 = 0 ; CameraFileType arg3 ; - char **arg4 = (char **) 0 ; + char **arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5605,8 +5953,8 @@ SWIGINTERN PyObject *_wrap_gp_file_get_name_by_type(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_file_set_data_and_size(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + CameraFile *arg1 = 0 ; + char *arg2 = 0 ; unsigned long arg3 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5661,9 +6009,9 @@ SWIGINTERN PyObject *_wrap_gp_file_set_data_and_size(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_file_get_data_and_size(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char **arg2 = (char **) 0 ; - unsigned long *arg3 = (unsigned long *) 0 ; + CameraFile *arg1 = 0 ; + char **arg2 = 0 ; + unsigned long *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp_data2 = NULL ; @@ -5699,8 +6047,8 @@ SWIGINTERN PyObject *_wrap_gp_file_get_data_and_size(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_file_open(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5733,8 +6081,8 @@ SWIGINTERN PyObject *_wrap_gp_file_open(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_save(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - char *arg2 = (char *) 0 ; + CameraFile *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5771,7 +6119,7 @@ SWIGINTERN PyObject *_wrap_gp_file_save(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_clean(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; + CameraFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5793,8 +6141,8 @@ SWIGINTERN PyObject *_wrap_gp_file_clean(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_file_copy(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraFile *arg1 = (CameraFile *) 0 ; - CameraFile *arg2 = (CameraFile *) 0 ; + CameraFile *arg1 = 0 ; + CameraFile *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -6195,11 +6543,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet CameraFile___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraFile_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"\n" - "_CameraFile\n" - "CameraFile\n" - "The internals of the CameraFile struct are private.\n" - "", &CameraFile___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraFile___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -6212,7 +6556,7 @@ SwigPyBuiltin___CameraFile_richcompare(PyObject *self, PyObject *other, int op) SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6560,7 +6904,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFile_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_CameraFile, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6709,6 +7053,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFile_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6732,7 +7079,6 @@ static PyTypeObject *SwigPyBuiltin___CameraFile_type_create(PyTypeObject *type, SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraFile'."); return NULL; } return pytype; @@ -6740,78 +7086,14 @@ static PyTypeObject *SwigPyBuiltin___CameraFile_type_create(PyTypeObject *type, #else static PyTypeObject *SwigPyBuiltin___CameraFile_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_CameraFile }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraFile_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_CameraFile }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraFile_destructor_closure }, { Py_tp_doc, (void *)"The internals of the CameraFile struct are private." }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraFile_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraFile_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraFile_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraFile_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -6822,10 +7104,15 @@ static PyTypeObject *SwigPyBuiltin___CameraFile_type_create(PyTypeObject *type, slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6896,7 +7183,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -6911,15 +7198,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -6931,8 +7223,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -6950,6 +7305,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -7001,8 +7396,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -7028,48 +7424,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -7100,7 +7549,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -7108,13 +7556,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -7218,6 +7669,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -7229,21 +7682,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -7281,27 +7759,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -7320,19 +7802,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -7357,7 +7835,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -7373,15 +7853,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraFile_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraFile_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraFile", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraFile", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraFile"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_MIME_TXT",SWIG_FromCharPtr("text/plain")); @@ -7426,10 +7905,6 @@ SWIG_init(void) { /* Initialize threading */ SWIG_PYTHON_INITIALIZE_THREADS; -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/filesys.py b/src/swig-gp2_5_33/filesys.py index e976a85..0e0ba04 100644 --- a/src/swig-gp2_5_33/filesys.py +++ b/src/swig-gp2_5_33/filesys.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. @@ -8,7 +8,7 @@ import gphoto2.file # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._filesys import * else: from _filesys import * diff --git a/src/swig-gp2_5_33/filesys_wrap.c b/src/swig-gp2_5_33/filesys_wrap.c index 859ceaf..0ae4c03 100644 --- a/src/swig-gp2_5_33/filesys_wrap.c +++ b/src/swig-gp2_5_33/filesys_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4039,9 +4387,6 @@ static swig_module_info swig_module = {swig_types, 27, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4114,6 +4459,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4340,7 +4688,7 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4355,7 +4703,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4382,7 +4730,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -4451,7 +4799,7 @@ SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { - if (size > INT_MAX) { + if (size > (size_t)PY_SSIZE_T_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); @@ -4512,7 +4860,7 @@ extern "C" { #endif SWIGINTERN PyObject *_wrap_CameraFileInfoFile_fields_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; CameraFileInfoFields arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4541,7 +4889,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_fields_set(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraFileInfoFile_fields_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileInfoFields result; @@ -4562,7 +4910,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_fields_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraFileInfoFile_status_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; CameraFileStatus arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4591,7 +4939,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_status_set(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraFileInfoFile_status_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileStatus result; @@ -4612,7 +4960,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_status_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraFileInfoFile_size_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; uint64_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4641,7 +4989,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_size_set(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoFile_size_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint64_t result; @@ -4662,8 +5010,8 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_size_get(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoFile_type_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; - char *arg2 = (char *) (char *)0 ; + struct _CameraFileInfoFile *arg1 = 0 ; + char *arg2 = (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[64] ; @@ -4692,7 +5040,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_type_set(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoFile_type_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -4719,7 +5067,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_type_get(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoFile_width_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; uint32_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4748,7 +5096,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_width_set(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoFile_width_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint32_t result; @@ -4769,7 +5117,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_width_get(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoFile_height_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; uint32_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4798,7 +5146,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_height_set(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraFileInfoFile_height_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint32_t result; @@ -4819,7 +5167,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_height_get(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_CameraFileInfoFile_permissions_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; CameraFilePermissions arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4848,7 +5196,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_permissions_set(PyObject *self, Py SWIGINTERN PyObject *_wrap_CameraFileInfoFile_permissions_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFilePermissions result; @@ -4869,7 +5217,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_permissions_get(PyObject *self, Py SWIGINTERN PyObject *_wrap_CameraFileInfoFile_mtime_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; time_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4898,7 +5246,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_mtime_set(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoFile_mtime_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; time_t result; @@ -4919,7 +5267,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoFile_mtime_get(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_delete_CameraFileInfoFile(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoFile *arg1 = (struct _CameraFileInfoFile *) 0 ; + struct _CameraFileInfoFile *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4941,7 +5289,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CameraFileInfoFile) /* defines _wrap_dele SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_fields_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; CameraFileInfoFields arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4970,7 +5318,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_fields_set(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_fields_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileInfoFields result; @@ -4991,7 +5339,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_fields_get(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_status_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; CameraFileStatus arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5020,7 +5368,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_status_set(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_status_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileStatus result; @@ -5041,7 +5389,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_status_get(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_size_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; uint64_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5070,7 +5418,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_size_set(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_size_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint64_t result; @@ -5091,8 +5439,8 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_size_get(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_type_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; - char *arg2 = (char *) (char *)0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; + char *arg2 = (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[64] ; @@ -5121,7 +5469,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_type_set(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_type_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5148,7 +5496,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_type_get(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_width_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; uint32_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5177,7 +5525,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_width_set(PyObject *self, PyObj SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_width_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint32_t result; @@ -5198,7 +5546,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_width_get(PyObject *self, PyObj SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_height_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; uint32_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5227,7 +5575,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_height_set(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_height_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint32_t result; @@ -5248,7 +5596,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoPreview_height_get(PyObject *self, PyOb SWIGINTERN PyObject *_wrap_delete_CameraFileInfoPreview(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoPreview *arg1 = (struct _CameraFileInfoPreview *) 0 ; + struct _CameraFileInfoPreview *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5270,7 +5618,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CameraFileInfoPreview) /* defines _wrap_d SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_fields_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; CameraFileInfoFields arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5299,7 +5647,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_fields_set(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_fields_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileInfoFields result; @@ -5320,7 +5668,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_fields_get(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_status_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; CameraFileStatus arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5349,7 +5697,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_status_set(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_status_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileStatus result; @@ -5370,7 +5718,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_status_get(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_size_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; uint64_t arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5399,7 +5747,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_size_set(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_size_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint64_t result; @@ -5420,8 +5768,8 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_size_get(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_type_set(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; - char *arg2 = (char *) (char *)0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; + char *arg2 = (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[64] ; @@ -5450,7 +5798,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_type_set(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_type_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5477,7 +5825,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfoAudio_type_get(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_delete_CameraFileInfoAudio(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfoAudio *arg1 = (struct _CameraFileInfoAudio *) 0 ; + struct _CameraFileInfoAudio *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5499,7 +5847,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CameraFileInfoAudio) /* defines _wrap_del SWIGINTERN PyObject *_wrap_CameraFileInfo_preview_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfo *arg1 = (struct _CameraFileInfo *) 0 ; + struct _CameraFileInfo *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileInfoPreview *result = 0 ; @@ -5520,7 +5868,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfo_preview_get(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_CameraFileInfo_file_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfo *arg1 = (struct _CameraFileInfo *) 0 ; + struct _CameraFileInfo *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileInfoFile *result = 0 ; @@ -5541,7 +5889,7 @@ SWIGINTERN PyObject *_wrap_CameraFileInfo_file_get(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_CameraFileInfo_audio_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfo *arg1 = (struct _CameraFileInfo *) 0 ; + struct _CameraFileInfo *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraFileInfoAudio *result = 0 ; @@ -5576,7 +5924,7 @@ SWIGINTERN int _wrap_new_CameraFileInfo(PyObject *self, PyObject *args, PyObject SWIGINTERN PyObject *_wrap_delete_CameraFileInfo(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraFileInfo *arg1 = (struct _CameraFileInfo *) 0 ; + struct _CameraFileInfo *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5598,7 +5946,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_CameraFileInfo) /* defines _wrap_delete_C SWIGINTERN PyObject *_wrap_CameraStorageInformation_fields_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraStorageInfoFields result; @@ -5619,7 +5967,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_fields_get(PyObject *self, P SWIGINTERN PyObject *_wrap_CameraStorageInformation_basedir_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5646,7 +5994,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_basedir_get(PyObject *self, SWIGINTERN PyObject *_wrap_CameraStorageInformation_label_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5673,7 +6021,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_label_get(PyObject *self, Py SWIGINTERN PyObject *_wrap_CameraStorageInformation_description_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *result = 0 ; @@ -5700,7 +6048,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_description_get(PyObject *se SWIGINTERN PyObject *_wrap_CameraStorageInformation_type_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraStorageType result; @@ -5721,7 +6069,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_type_get(PyObject *self, PyO SWIGINTERN PyObject *_wrap_CameraStorageInformation_fstype_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraStorageFilesystemType result; @@ -5742,7 +6090,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_fstype_get(PyObject *self, P SWIGINTERN PyObject *_wrap_CameraStorageInformation_access_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraStorageAccessType result; @@ -5763,7 +6111,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_access_get(PyObject *self, P SWIGINTERN PyObject *_wrap_CameraStorageInformation_capacitykbytes_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint64_t result; @@ -5784,7 +6132,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_capacitykbytes_get(PyObject SWIGINTERN PyObject *_wrap_CameraStorageInformation_freekbytes_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint64_t result; @@ -5805,7 +6153,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_freekbytes_get(PyObject *sel SWIGINTERN PyObject *_wrap_CameraStorageInformation_freeimages_get(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; uint64_t result; @@ -5826,7 +6174,7 @@ SWIGINTERN PyObject *_wrap_CameraStorageInformation_freeimages_get(PyObject *sel SWIGINTERN PyObject *_wrap_delete_CameraStorageInformation(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraStorageInformation *arg1 = (struct _CameraStorageInformation *) 0 ; + struct _CameraStorageInformation *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5864,7 +6212,7 @@ SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraFileInfoFile_getset[] = { { (char *)"size", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"size", &CameraFileInfoFile_size_getset }, { (char *)"status", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"status", &CameraFileInfoFile_status_getset }, { (char *)"permissions", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"permissions", &CameraFileInfoFile_permissions_getset }, - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"fields", &CameraFileInfoFile___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraFileInfoFile___dict___getset }, { (char *)"fields", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"fields", &CameraFileInfoFile_fields_getset }, { (char *)"width", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"width", &CameraFileInfoFile_width_getset }, { (char *)"height", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"height", &CameraFileInfoFile_height_getset }, @@ -5881,7 +6229,7 @@ SwigPyBuiltin___CameraFileInfoFile_richcompare(PyObject *self, PyObject *other, SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -5956,7 +6304,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfoFile_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6105,6 +6453,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfoFile_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6128,7 +6479,6 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoFile_type_create(PyTypeObject SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraFileInfoFile'."); return NULL; } return pytype; @@ -6136,17 +6486,9 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoFile_type_create(PyTypeObject #else static PyTypeObject *SwigPyBuiltin___CameraFileInfoFile_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraFileInfoFile_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraFileInfoFile_destructor_closure }, { Py_tp_doc, (void *)"\n" "File information of a regular file. \n" "\n" @@ -6155,66 +6497,10 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoFile_type_create(PyTypeObject "\n" "C++ includes: gphoto2-filesys.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraFileInfoFile_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraFileInfoFile_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraFileInfoFile_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraFileInfoFile_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -6225,10 +6511,15 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoFile_type_create(PyTypeObject slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6246,7 +6537,7 @@ SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraFileInfoPreview_getset[] = { { (char *)"type", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"type", &CameraFileInfoPreview_type_getset }, { (char *)"size", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"size", &CameraFileInfoPreview_size_getset }, { (char *)"status", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"status", &CameraFileInfoPreview_status_getset }, - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"fields", &CameraFileInfoPreview___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraFileInfoPreview___dict___getset }, { (char *)"fields", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"fields", &CameraFileInfoPreview_fields_getset }, { (char *)"width", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"width", &CameraFileInfoPreview_width_getset }, { (char *)"height", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"height", &CameraFileInfoPreview_height_getset }, @@ -6262,7 +6553,7 @@ SwigPyBuiltin___CameraFileInfoPreview_richcompare(PyObject *self, PyObject *othe SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6337,7 +6628,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfoPreview_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6486,6 +6777,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfoPreview_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6509,7 +6803,6 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoPreview_type_create(PyTypeObj SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraFileInfoPreview'."); return NULL; } return pytype; @@ -6517,17 +6810,9 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoPreview_type_create(PyTypeObj #else static PyTypeObject *SwigPyBuiltin___CameraFileInfoPreview_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraFileInfoPreview_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraFileInfoPreview_destructor_closure }, { Py_tp_doc, (void *)"\n" "File information of a preview file. \n" "\n" @@ -6536,66 +6821,10 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoPreview_type_create(PyTypeObj "\n" "C++ includes: gphoto2-filesys.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraFileInfoPreview_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraFileInfoPreview_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraFileInfoPreview_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraFileInfoPreview_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -6606,10 +6835,15 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoPreview_type_create(PyTypeObj slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6625,7 +6859,7 @@ SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraFileInfoAudio_getset[] = { { (char *)"type", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"type", &CameraFileInfoAudio_type_getset }, { (char *)"size", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"size", &CameraFileInfoAudio_size_getset }, { (char *)"status", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"status", &CameraFileInfoAudio_status_getset }, - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"fields", &CameraFileInfoAudio___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraFileInfoAudio___dict___getset }, { (char *)"fields", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, (char *)"fields", &CameraFileInfoAudio_fields_getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -6639,7 +6873,7 @@ SwigPyBuiltin___CameraFileInfoAudio_richcompare(PyObject *self, PyObject *other, SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6714,7 +6948,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfoAudio_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6863,6 +7097,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfoAudio_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6886,7 +7123,6 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoAudio_type_create(PyTypeObjec SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraFileInfoAudio'."); return NULL; } return pytype; @@ -6894,17 +7130,9 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoAudio_type_create(PyTypeObjec #else static PyTypeObject *SwigPyBuiltin___CameraFileInfoAudio_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraFileInfoAudio_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraFileInfoAudio_destructor_closure }, { Py_tp_doc, (void *)"\n" "File information of an audio file. \n" "\n" @@ -6913,66 +7141,10 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoAudio_type_create(PyTypeObjec "\n" "C++ includes: gphoto2-filesys.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraFileInfoAudio_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraFileInfoAudio_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraFileInfoAudio_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraFileInfoAudio_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -6983,10 +7155,15 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfoAudio_type_create(PyTypeObjec slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -7001,7 +7178,7 @@ SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraFileInfo_getset[] = { { (char *)"file", SwigPyBuiltin_GetterClosure, 0, (char *)"file", &CameraFileInfo_file_getset }, { (char *)"audio", SwigPyBuiltin_GetterClosure, 0, (char *)"audio", &CameraFileInfo_audio_getset }, { (char *)"preview", SwigPyBuiltin_GetterClosure, 0, (char *)"preview", &CameraFileInfo_preview_getset }, - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"preview", &CameraFileInfo___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraFileInfo___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -7014,7 +7191,7 @@ SwigPyBuiltin___CameraFileInfo_richcompare(PyObject *self, PyObject *other, int SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -7089,7 +7266,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfo_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_CameraFileInfo, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -7238,6 +7415,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraFileInfo_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -7261,7 +7441,6 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfo_type_create(PyTypeObject *ty SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraFileInfo'."); return NULL; } return pytype; @@ -7269,17 +7448,9 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfo_type_create(PyTypeObject *ty #else static PyTypeObject *SwigPyBuiltin___CameraFileInfo_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_CameraFileInfo }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraFileInfo_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_CameraFileInfo }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraFileInfo_destructor_closure }, { Py_tp_doc, (void *)"\n" "File information structure. \n" "\n" @@ -7288,66 +7459,10 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfo_type_create(PyTypeObject *ty "\n" "C++ includes: gphoto2-filesys.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraFileInfo_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraFileInfo_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraFileInfo_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraFileInfo_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -7358,10 +7473,15 @@ static PyTypeObject *SwigPyBuiltin___CameraFileInfo_type_create(PyTypeObject *ty slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -7385,7 +7505,7 @@ SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraStorageInformation_getset[] = { { (char *)"fstype", SwigPyBuiltin_GetterClosure, 0, (char *)"fstype", &CameraStorageInformation_fstype_getset }, { (char *)"capacitykbytes", SwigPyBuiltin_GetterClosure, 0, (char *)"capacitykbytes", &CameraStorageInformation_capacitykbytes_getset }, { (char *)"freekbytes", SwigPyBuiltin_GetterClosure, 0, (char *)"freekbytes", &CameraStorageInformation_freekbytes_getset }, - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"fields", &CameraStorageInformation___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraStorageInformation___dict___getset }, { (char *)"fields", SwigPyBuiltin_GetterClosure, 0, (char *)"fields", &CameraStorageInformation_fields_getset }, { (char *)"label", SwigPyBuiltin_GetterClosure, 0, (char *)"label", &CameraStorageInformation_label_getset }, { (char *)"description", SwigPyBuiltin_GetterClosure, 0, (char *)"description", &CameraStorageInformation_description_getset }, @@ -7403,7 +7523,7 @@ SwigPyBuiltin___CameraStorageInformation_richcompare(PyObject *self, PyObject *o SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -7478,7 +7598,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraStorageInformation_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -7627,6 +7747,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraStorageInformation_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -7650,7 +7773,6 @@ static PyTypeObject *SwigPyBuiltin___CameraStorageInformation_type_create(PyType SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraStorageInformation'."); return NULL; } return pytype; @@ -7658,17 +7780,9 @@ static PyTypeObject *SwigPyBuiltin___CameraStorageInformation_type_create(PyType #else static PyTypeObject *SwigPyBuiltin___CameraStorageInformation_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraStorageInformation_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraStorageInformation_destructor_closure }, { Py_tp_doc, (void *)"\n" "Storage information structue. \n" "\n" @@ -7677,66 +7791,10 @@ static PyTypeObject *SwigPyBuiltin___CameraStorageInformation_type_create(PyType "\n" "C++ includes: gphoto2-filesys.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraStorageInformation_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraStorageInformation_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraStorageInformation_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraStorageInformation_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -7747,10 +7805,15 @@ static PyTypeObject *SwigPyBuiltin___CameraStorageInformation_type_create(PyType slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -7889,7 +7952,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -7904,15 +7967,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -7924,8 +7992,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -7943,6 +8074,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -7994,8 +8165,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -8021,48 +8193,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -8093,7 +8318,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -8101,13 +8325,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -8211,6 +8438,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -8222,21 +8451,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -8274,27 +8528,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -8313,19 +8571,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -8350,7 +8604,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -8381,15 +8637,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraFileInfoFile_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraFileInfoFile_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraFileInfoFile", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraFileInfoFile", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraFileInfoFile"); d = md; @@ -8401,15 +8656,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraFileInfoPreview_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraFileInfoPreview_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraFileInfoPreview", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraFileInfoPreview", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraFileInfoPreview"); d = md; @@ -8421,15 +8675,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraFileInfoAudio_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraFileInfoAudio_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraFileInfoAudio", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraFileInfoAudio", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraFileInfoAudio"); d = md; @@ -8441,15 +8694,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraFileInfo_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraFileInfo_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraFileInfo", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraFileInfo", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraFileInfo"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_STORAGEINFO_BASE",SWIG_From_int((int)(GP_STORAGEINFO_BASE))); @@ -8482,21 +8734,16 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraStorageInformation_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraStorageInformation_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraStorageInformation", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraStorageInformation", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraStorageInformation"); d = md; -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/list.py b/src/swig-gp2_5_33/list.py index e5ab17a..403ee2a 100644 --- a/src/swig-gp2_5_33/list.py +++ b/src/swig-gp2_5_33/list.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._list import * else: from _list import * diff --git a/src/swig-gp2_5_33/list_wrap.c b/src/swig-gp2_5_33/list_wrap.c index 4df4c63..5db2255 100644 --- a/src/swig-gp2_5_33/list_wrap.c +++ b/src/swig-gp2_5_33/list_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4019,9 +4367,6 @@ static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4160,6 +4505,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4287,7 +4635,7 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4302,7 +4650,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4329,7 +4677,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -4602,7 +4950,7 @@ SWIGINTERN int _wrap_new_CameraList(PyObject *self, PyObject *args, PyObject *kw SWIGINTERN PyObject *_wrap_delete_CameraList(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4625,7 +4973,7 @@ SWIGINTERN PyObject *_wrap_delete_CameraList(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList___getitem____SWIG_0(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4647,6 +4995,7 @@ SWIGINTERN PyObject *_wrap_CameraList___getitem____SWIG_0(PyObject *self, PyObje arg2 = (int)(val2); result = (PyObject *)_CameraList___getitem____SWIG_0(arg1,arg2); resultobj = result; + if (!resultobj) SWIG_fail; return resultobj; fail: return NULL; @@ -4655,8 +5004,8 @@ SWIGINTERN PyObject *_wrap_CameraList___getitem____SWIG_0(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraList___getitem____SWIG_1(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraList *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4678,6 +5027,7 @@ SWIGINTERN PyObject *_wrap_CameraList___getitem____SWIG_1(PyObject *self, PyObje arg2 = (char *)(buf2); result = (PyObject *)_CameraList___getitem____SWIG_1(arg1,(char const *)arg2); resultobj = result; + if (!resultobj) SWIG_fail; if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: @@ -4733,7 +5083,7 @@ SWIGINTERN PyObject *_wrap_CameraList___getitem__(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraList_keys(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraList_accessor *result = 0 ; @@ -4754,7 +5104,7 @@ SWIGINTERN PyObject *_wrap_CameraList_keys(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_values(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraList_accessor *result = 0 ; @@ -4775,7 +5125,7 @@ SWIGINTERN PyObject *_wrap_CameraList_values(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_items(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraList_accessor *result = 0 ; @@ -4796,7 +5146,7 @@ SWIGINTERN PyObject *_wrap_CameraList_items(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList___iter__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *result = 0 ; @@ -4816,6 +5166,7 @@ SWIGINTERN PyObject *_wrap_CameraList___iter__(PyObject *self, PyObject *args) { } resultobj = result; + if (!resultobj) SWIG_fail; return resultobj; fail: return NULL; @@ -4824,7 +5175,7 @@ SWIGINTERN PyObject *_wrap_CameraList___iter__(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList___len__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -4848,7 +5199,7 @@ SWIGINTERN PyObject *_wrap_CameraList___len__(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_count(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -4872,9 +5223,9 @@ SWIGINTERN PyObject *_wrap_CameraList_count(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_append(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + struct _CameraList *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4919,7 +5270,7 @@ SWIGINTERN PyObject *_wrap_CameraList_append(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_reset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4942,7 +5293,7 @@ SWIGINTERN PyObject *_wrap_CameraList_reset(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_sort(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4965,9 +5316,9 @@ SWIGINTERN PyObject *_wrap_CameraList_sort(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_find_by_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; - int *arg2 = (int *) 0 ; - char *arg3 = (char *) 0 ; + struct _CameraList *arg1 = 0 ; + int *arg2 = 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int temp2 = 0 ; @@ -5008,9 +5359,9 @@ SWIGINTERN PyObject *_wrap_CameraList_find_by_name(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_CameraList_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; int arg2 ; - char **arg3 = (char **) 0 ; + char **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5050,9 +5401,9 @@ SWIGINTERN PyObject *_wrap_CameraList_get_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_get_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; int arg2 ; - char **arg3 = (char **) 0 ; + char **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5092,9 +5443,9 @@ SWIGINTERN PyObject *_wrap_CameraList_get_value(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraList_set_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; int arg2 ; - char *arg3 = (char *) 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5136,9 +5487,9 @@ SWIGINTERN PyObject *_wrap_CameraList_set_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraList_set_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; + struct _CameraList *arg1 = 0 ; int arg2 ; - char *arg3 = (char *) 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5180,8 +5531,8 @@ SWIGINTERN PyObject *_wrap_CameraList_set_value(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraList_populate(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList *arg1 = (struct _CameraList *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraList *arg1 = 0 ; + char *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5236,7 +5587,7 @@ SWIGPY_LENFUNC_CLOSURE(_wrap_CameraList___len__) /* defines _wrap_CameraList___l SWIGINTERN PyObject *_wrap_delete_CameraList_accessor(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList_accessor *arg1 = (struct _CameraList_accessor *) 0 ; + struct _CameraList_accessor *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5259,7 +5610,7 @@ SWIGINTERN PyObject *_wrap_delete_CameraList_accessor(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_CameraList_accessor___len__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList_accessor *arg1 = (struct _CameraList_accessor *) 0 ; + struct _CameraList_accessor *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5283,7 +5634,7 @@ SWIGINTERN PyObject *_wrap_CameraList_accessor___len__(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraList_accessor___getitem__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraList_accessor *arg1 = (struct _CameraList_accessor *) 0 ; + struct _CameraList_accessor *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5308,6 +5659,7 @@ SWIGINTERN PyObject *_wrap_CameraList_accessor___getitem__(PyObject *self, PyObj if (PyErr_Occurred()) SWIG_fail; } resultobj = result; + if (!resultobj) SWIG_fail; return resultobj; fail: return NULL; @@ -5322,7 +5674,7 @@ SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_CameraList_accessor___getitem__) /* defines _w SWIGINTERN PyObject *_wrap_gp_list_new(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList **arg1 = (CameraList **) 0 ; + CameraList **arg1 = 0 ; CameraList *temp1 ; int result; @@ -5345,7 +5697,7 @@ SWIGINTERN PyObject *_wrap_gp_list_new(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_count(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; + CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5367,9 +5719,9 @@ SWIGINTERN PyObject *_wrap_gp_list_count(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_append(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + CameraList *arg1 = 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5413,7 +5765,7 @@ SWIGINTERN PyObject *_wrap_gp_list_append(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_reset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; + CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5435,7 +5787,7 @@ SWIGINTERN PyObject *_wrap_gp_list_reset(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_sort(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; + CameraList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5457,9 +5809,9 @@ SWIGINTERN PyObject *_wrap_gp_list_sort(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_find_by_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; - int *arg2 = (int *) 0 ; - char *arg3 = (char *) 0 ; + CameraList *arg1 = 0 ; + int *arg2 = 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int temp2 = 0 ; @@ -5499,9 +5851,9 @@ SWIGINTERN PyObject *_wrap_gp_list_find_by_name(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_list_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; + CameraList *arg1 = 0 ; int arg2 ; - char **arg3 = (char **) 0 ; + char **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5540,9 +5892,9 @@ SWIGINTERN PyObject *_wrap_gp_list_get_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_get_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; + CameraList *arg1 = 0 ; int arg2 ; - char **arg3 = (char **) 0 ; + char **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5581,9 +5933,9 @@ SWIGINTERN PyObject *_wrap_gp_list_get_value(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_set_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; + CameraList *arg1 = 0 ; int arg2 ; - char *arg3 = (char *) 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5624,9 +5976,9 @@ SWIGINTERN PyObject *_wrap_gp_list_set_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_set_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; + CameraList *arg1 = 0 ; int arg2 ; - char *arg3 = (char *) 0 ; + char *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5667,8 +6019,8 @@ SWIGINTERN PyObject *_wrap_gp_list_set_value(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_list_populate(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraList *arg1 = (CameraList *) 0 ; - char *arg2 = (char *) 0 ; + CameraList *arg1 = 0 ; + char *arg2 = 0 ; int arg3 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5960,7 +6312,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet CameraList___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraList_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"_CameraList", &CameraList___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraList___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -5973,7 +6325,7 @@ SwigPyBuiltin___CameraList_richcompare(PyObject *self, PyObject *other, int op) SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6275,7 +6627,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraList_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_CameraList, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6424,6 +6776,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraList_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6447,7 +6802,6 @@ static PyTypeObject *SwigPyBuiltin___CameraList_type_create(PyTypeObject *type, SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraList'."); return NULL; } return pytype; @@ -6455,78 +6809,17 @@ static PyTypeObject *SwigPyBuiltin___CameraList_type_create(PyTypeObject *type, #else static PyTypeObject *SwigPyBuiltin___CameraList_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_CameraList }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraList_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_CameraList }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraList_destructor_closure }, { Py_tp_doc, (void *)"::_CameraList" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraList_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraList_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraList_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraList_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)_wrap_CameraList___getitem___binaryfunc_closure }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)_wrap_CameraList___iter___getiterfunc_closure }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)_wrap_CameraList___len___lenfunc_closure }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, + { Py_tp_iter, (void *)(getiterfunc) _wrap_CameraList___iter___getiterfunc_closure }, + { Py_mp_subscript, (void *)(binaryfunc) _wrap_CameraList___getitem___binaryfunc_closure }, + { Py_sq_length, (void *)(lenfunc) _wrap_CameraList___len___lenfunc_closure }, { 0, NULL } }; PyType_Spec spec = { @@ -6537,10 +6830,15 @@ static PyTypeObject *SwigPyBuiltin___CameraList_type_create(PyTypeObject *type, slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6549,7 +6847,7 @@ SWIGINTERN SwigPyClientData SwigPyBuiltin___CameraList_clientdata = {0, 0, 0, 0, static SwigPyGetSet CameraList_accessor___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraList_accessor_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"~_CameraList_accessor", &CameraList_accessor___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraList_accessor___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -6562,7 +6860,7 @@ SwigPyBuiltin___CameraList_accessor_richcompare(PyObject *self, PyObject *other, SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6643,7 +6941,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraList_accessor_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6792,6 +7090,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraList_accessor_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6815,7 +7116,6 @@ static PyTypeObject *SwigPyBuiltin___CameraList_accessor_type_create(PyTypeObjec SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraList_accessor'."); return NULL; } return pytype; @@ -6823,82 +7123,20 @@ static PyTypeObject *SwigPyBuiltin___CameraList_accessor_type_create(PyTypeObjec #else static PyTypeObject *SwigPyBuiltin___CameraList_accessor_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraList_accessor_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraList_accessor_destructor_closure }, { Py_tp_doc, (void *)"\n" "List-like access to CameraList keys, values, or (key, value) items.\n" "\n" "This can be accessed or iterated over like any Python list or tuple.\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraList_accessor_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraList_accessor_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraList_accessor_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraList_accessor_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)_wrap_CameraList_accessor___len___lenfunc_closure }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)_wrap_CameraList_accessor___getitem___ssizeargfunc_closure }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, + { Py_sq_length, (void *)(lenfunc) _wrap_CameraList_accessor___len___lenfunc_closure }, + { Py_sq_item, (void *)(ssizeargfunc) _wrap_CameraList_accessor___getitem___ssizeargfunc_closure }, { 0, NULL } }; PyType_Spec spec = { @@ -6909,10 +7147,15 @@ static PyTypeObject *SwigPyBuiltin___CameraList_accessor_type_create(PyTypeObjec slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6971,7 +7214,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -6986,15 +7229,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -7006,8 +7254,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -7025,6 +7336,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -7076,8 +7427,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -7103,48 +7455,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -7175,7 +7580,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -7183,13 +7587,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -7293,6 +7700,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -7304,21 +7713,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -7356,27 +7790,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -7395,19 +7833,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -7432,7 +7866,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -7448,15 +7884,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraList_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraList_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraList", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraList", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraList"); d = md; @@ -7468,21 +7903,16 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraList_accessor_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraList_accessor_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraList_accessor", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraList_accessor", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraList_accessor"); d = md; -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/port.py b/src/swig-gp2_5_33/port.py index 6fe8a60..42ddbeb 100644 --- a/src/swig-gp2_5_33/port.py +++ b/src/swig-gp2_5_33/port.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. @@ -8,7 +8,7 @@ import gphoto2.port_info_list # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._port import * else: from _port import * diff --git a/src/swig-gp2_5_33/port_info_list.py b/src/swig-gp2_5_33/port_info_list.py index e57e5fb..b75c402 100644 --- a/src/swig-gp2_5_33/port_info_list.py +++ b/src/swig-gp2_5_33/port_info_list.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._port_info_list import * else: from _port_info_list import * diff --git a/src/swig-gp2_5_33/port_info_list_wrap.c b/src/swig-gp2_5_33/port_info_list_wrap.c index 64577f1..414872f 100644 --- a/src/swig-gp2_5_33/port_info_list_wrap.c +++ b/src/swig-gp2_5_33/port_info_list_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; + +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4020,9 +4368,6 @@ static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4152,6 +4497,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4345,7 +4693,7 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4360,7 +4708,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4387,7 +4735,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -4489,7 +4837,7 @@ SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { - if (size > INT_MAX) { + if (size > (size_t)PY_SSIZE_T_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); @@ -4521,8 +4869,8 @@ extern "C" { #endif SWIGINTERN PyObject *_wrap_GPPortInfo_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfo *arg1 = (struct _GPPortInfo *) 0 ; - char **arg2 = (char **) 0 ; + struct _GPPortInfo *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -4554,8 +4902,8 @@ SWIGINTERN PyObject *_wrap_GPPortInfo_get_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPortInfo_get_path(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfo *arg1 = (struct _GPPortInfo *) 0 ; - char **arg2 = (char **) 0 ; + struct _GPPortInfo *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -4587,8 +4935,8 @@ SWIGINTERN PyObject *_wrap_GPPortInfo_get_path(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPortInfo_get_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfo *arg1 = (struct _GPPortInfo *) 0 ; - GPPortType *arg2 = (GPPortType *) 0 ; + struct _GPPortInfo *arg1 = 0 ; + GPPortType *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GPPortType temp2 ; @@ -4620,7 +4968,7 @@ SWIGINTERN PyObject *_wrap_GPPortInfo_get_type(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_delete_GPPortInfo(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfo *arg1 = (struct _GPPortInfo *) 0 ; + struct _GPPortInfo *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4642,7 +4990,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_GPPortInfo) /* defines _wrap_delete_GPPor SWIGINTERN PyObject *_wrap_GPPortInfoList___len__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -4666,9 +5014,9 @@ SWIGINTERN PyObject *_wrap_GPPortInfoList___len__(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_GPPortInfoList___getitem__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; int arg2 ; - GPPortInfo *arg3 = (GPPortInfo *) 0 ; + GPPortInfo *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -4727,7 +5075,7 @@ SWIGINTERN int _wrap_new_GPPortInfoList(PyObject *self, PyObject *args, PyObject SWIGINTERN PyObject *_wrap_delete_GPPortInfoList(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4750,8 +5098,8 @@ SWIGINTERN PyObject *_wrap_delete_GPPortInfoList(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_GPPortInfoList_append(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; - GPPortInfo arg2 = (GPPortInfo) 0 ; + struct _GPPortInfoList *arg1 = 0 ; + GPPortInfo arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -4786,7 +5134,7 @@ SWIGINTERN PyObject *_wrap_GPPortInfoList_append(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_GPPortInfoList_load(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4809,7 +5157,7 @@ SWIGINTERN PyObject *_wrap_GPPortInfoList_load(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPortInfoList_count(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -4833,8 +5181,8 @@ SWIGINTERN PyObject *_wrap_GPPortInfoList_count(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_GPPortInfoList_lookup_path(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; - char *arg2 = (char *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4869,8 +5217,8 @@ SWIGINTERN PyObject *_wrap_GPPortInfoList_lookup_path(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_GPPortInfoList_lookup_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; - char *arg2 = (char *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4905,9 +5253,9 @@ SWIGINTERN PyObject *_wrap_GPPortInfoList_lookup_name(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_GPPortInfoList_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPortInfoList *arg1 = (struct _GPPortInfoList *) 0 ; + struct _GPPortInfoList *arg1 = 0 ; int arg2 ; - GPPortInfo *arg3 = (GPPortInfo *) 0 ; + GPPortInfo *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -4953,8 +5301,8 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_GPPortInfoList) /* defines _wrap_delete_G SWIGINTERN PyObject *_wrap_gp_port_info_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfo arg1 = (GPPortInfo) 0 ; - char **arg2 = (char **) 0 ; + GPPortInfo arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -4985,8 +5333,8 @@ SWIGINTERN PyObject *_wrap_gp_port_info_get_name(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_port_info_get_path(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfo arg1 = (GPPortInfo) 0 ; - char **arg2 = (char **) 0 ; + GPPortInfo arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -5017,8 +5365,8 @@ SWIGINTERN PyObject *_wrap_gp_port_info_get_path(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_port_info_get_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfo arg1 = (GPPortInfo) 0 ; - GPPortType *arg2 = (GPPortType *) 0 ; + GPPortInfo arg1 = 0 ; + GPPortType *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GPPortType temp2 ; @@ -5049,7 +5397,7 @@ SWIGINTERN PyObject *_wrap_gp_port_info_get_type(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_port_info_list_new(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfoList **arg1 = (GPPortInfoList **) 0 ; + GPPortInfoList **arg1 = 0 ; GPPortInfoList *temp1 ; int result; @@ -5072,8 +5420,8 @@ SWIGINTERN PyObject *_wrap_gp_port_info_list_new(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_port_info_list_append(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfoList *arg1 = (GPPortInfoList *) 0 ; - GPPortInfo arg2 = (GPPortInfo) 0 ; + GPPortInfoList *arg1 = 0 ; + GPPortInfo arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -5110,7 +5458,7 @@ SWIGINTERN PyObject *_wrap_gp_port_info_list_append(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_port_info_list_load(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfoList *arg1 = (GPPortInfoList *) 0 ; + GPPortInfoList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5132,7 +5480,7 @@ SWIGINTERN PyObject *_wrap_gp_port_info_list_load(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_gp_port_info_list_count(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfoList *arg1 = (GPPortInfoList *) 0 ; + GPPortInfoList *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -5154,8 +5502,8 @@ SWIGINTERN PyObject *_wrap_gp_port_info_list_count(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_port_info_list_lookup_path(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfoList *arg1 = (GPPortInfoList *) 0 ; - char *arg2 = (char *) 0 ; + GPPortInfoList *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5188,8 +5536,8 @@ SWIGINTERN PyObject *_wrap_gp_port_info_list_lookup_path(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_gp_port_info_list_lookup_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfoList *arg1 = (GPPortInfoList *) 0 ; - char *arg2 = (char *) 0 ; + GPPortInfoList *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5222,9 +5570,9 @@ SWIGINTERN PyObject *_wrap_gp_port_info_list_lookup_name(PyObject *self, PyObjec SWIGINTERN PyObject *_wrap_gp_port_info_list_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPortInfoList *arg1 = (GPPortInfoList *) 0 ; + GPPortInfoList *arg1 = 0 ; int arg2 ; - GPPortInfo *arg3 = (GPPortInfo *) 0 ; + GPPortInfo *arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5263,7 +5611,7 @@ SWIGINTERN PyObject *_wrap_gp_port_info_list_get_info(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_gp_port_message_codeset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; + char *arg1 = 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; @@ -5288,7 +5636,7 @@ SWIGINTERN PyObject *_wrap_gp_port_message_codeset(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_port_init_localedir(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; + char *arg1 = 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; @@ -5605,25 +5953,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet GPPortInfo___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___GPPortInfo_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"\n" - "get_name\n" - "Get name of a specific port entry. \n" - "\n" - "Parameters\n" - "----------\n" - "* `info` : \n" - " a #GPPortInfo \n" - "* `name` : \n" - " a pointer to a char* which will receive the name \n" - "\n" - "Retreives the name of the passed in GPPortInfo, by reference. \n" - "\n" - "Returns\n" - "-------\n" - "a gphoto2 error code\n" - "\n" - "See also gphoto2.gp_port_info_get_name\n" - "", &GPPortInfo___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &GPPortInfo___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -5636,7 +5966,7 @@ SwigPyBuiltin___GPPortInfo_richcompare(PyObject *self, PyObject *other, int op) SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -5761,7 +6091,7 @@ static PyHeapTypeObject SwigPyBuiltin___GPPortInfo_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -5910,6 +6240,9 @@ static PyHeapTypeObject SwigPyBuiltin___GPPortInfo_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -5933,7 +6266,6 @@ static PyTypeObject *SwigPyBuiltin___GPPortInfo_type_create(PyTypeObject *type, SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'GPPortInfo'."); return NULL; } return pytype; @@ -5941,78 +6273,14 @@ static PyTypeObject *SwigPyBuiltin___GPPortInfo_type_create(PyTypeObject *type, #else static PyTypeObject *SwigPyBuiltin___GPPortInfo_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_GPPortInfo_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_GPPortInfo_destructor_closure }, { Py_tp_doc, (void *)"::_GPPortInfo" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___GPPortInfo_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___GPPortInfo_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___GPPortInfo_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___GPPortInfo_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -6023,10 +6291,15 @@ static PyTypeObject *SwigPyBuiltin___GPPortInfo_type_create(PyTypeObject *type, slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6035,7 +6308,7 @@ SWIGINTERN SwigPyClientData SwigPyBuiltin___GPPortInfo_clientdata = {0, 0, 0, 0, static SwigPyGetSet GPPortInfoList___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___GPPortInfoList_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"__len__", &GPPortInfoList___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &GPPortInfoList___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -6048,7 +6321,7 @@ SwigPyBuiltin___GPPortInfoList_richcompare(PyObject *self, PyObject *other, int SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -6247,7 +6520,7 @@ static PyHeapTypeObject SwigPyBuiltin___GPPortInfoList_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_GPPortInfoList, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -6396,6 +6669,9 @@ static PyHeapTypeObject SwigPyBuiltin___GPPortInfoList_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -6419,7 +6695,6 @@ static PyTypeObject *SwigPyBuiltin___GPPortInfoList_type_create(PyTypeObject *ty SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'GPPortInfoList'."); return NULL; } return pytype; @@ -6427,78 +6702,16 @@ static PyTypeObject *SwigPyBuiltin___GPPortInfoList_type_create(PyTypeObject *ty #else static PyTypeObject *SwigPyBuiltin___GPPortInfoList_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_GPPortInfoList }, - { Py_tp_dealloc, (void *)_wrap_delete_GPPortInfoList_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_GPPortInfoList }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_GPPortInfoList_destructor_closure }, { Py_tp_doc, (void *)"::_GPPortInfoList" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___GPPortInfoList_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___GPPortInfoList_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___GPPortInfoList_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___GPPortInfoList_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)_wrap_GPPortInfoList___len___lenfunc_closure }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)_wrap_GPPortInfoList___getitem___ssizeargfunc_closure }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, + { Py_sq_length, (void *)(lenfunc) _wrap_GPPortInfoList___len___lenfunc_closure }, + { Py_sq_item, (void *)(ssizeargfunc) _wrap_GPPortInfoList___getitem___ssizeargfunc_closure }, { 0, NULL } }; PyType_Spec spec = { @@ -6509,10 +6722,15 @@ static PyTypeObject *SwigPyBuiltin___GPPortInfoList_type_create(PyTypeObject *ty slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -6575,7 +6793,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -6590,15 +6808,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -6610,8 +6833,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -6629,6 +6915,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -6680,8 +7006,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -6707,48 +7034,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -6779,7 +7159,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -6787,13 +7166,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -6897,6 +7279,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -6908,21 +7292,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -6960,27 +7369,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -6999,19 +7412,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -7036,7 +7445,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -7052,15 +7463,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___GPPortInfo_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___GPPortInfo_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "GPPortInfo", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "GPPortInfo", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "GPPortInfo"); d = md; @@ -7072,15 +7482,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___GPPortInfoList_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___GPPortInfoList_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "GPPortInfoList", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "GPPortInfoList", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "GPPortInfoList"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_PORT_NONE",SWIG_From_int((int)(GP_PORT_NONE))); @@ -7091,10 +7500,6 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_PORT_USB_DISK_DIRECT",SWIG_From_int((int)(GP_PORT_USB_DISK_DIRECT))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_PORT_USB_SCSI",SWIG_From_int((int)(GP_PORT_USB_SCSI))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_PORT_IP",SWIG_From_int((int)(GP_PORT_IP))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/port_log.py b/src/swig-gp2_5_33/port_log.py index aefbed6..9556ea4 100644 --- a/src/swig-gp2_5_33/port_log.py +++ b/src/swig-gp2_5_33/port_log.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._port_log import * else: from _port_log import * diff --git a/src/swig-gp2_5_33/port_log_wrap.c b/src/swig-gp2_5_33/port_log_wrap.c index e642cb4..ae34ac1 100644 --- a/src/swig-gp2_5_33/port_log_wrap.c +++ b/src/swig-gp2_5_33/port_log_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4018,9 +4366,6 @@ static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4140,6 +4485,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4280,7 +4628,7 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4295,7 +4643,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4322,7 +4670,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -4369,7 +4717,7 @@ extern "C" { #endif SWIGINTERN PyObject *_wrap_delete_LogFuncItem(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct LogFuncItem *arg1 = (struct LogFuncItem *) 0 ; + struct LogFuncItem *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4395,8 +4743,8 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_LogFuncItem) /* defines _wrap_delete_LogF SWIGINTERN PyObject *_wrap_Log_add_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; GPLogLevel arg1 ; - GPLogFunc arg2 = (GPLogFunc) 0 ; - void *arg3 = (void *) 0 ; + GPLogFunc arg2 = 0 ; + void *arg3 = 0 ; LogFuncItem *_global_callback ; int val1 ; int ecode1 = 0 ; @@ -4466,8 +4814,8 @@ SWIGINTERN PyObject *_wrap_Log_add_func(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_log_add_func(PyObject *self, PyObject *args) { PyObject *resultobj = 0; GPLogLevel arg1 ; - GPLogFunc arg2 = (GPLogFunc) 0 ; - void *arg3 = (void *) 0 ; + GPLogFunc arg2 = 0 ; + void *arg3 = 0 ; LogFuncItem *_global_callback ; int val1 ; int ecode1 = 0 ; @@ -4534,8 +4882,8 @@ SWIGINTERN PyObject *_wrap_gp_log_add_func(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_log__varargs__(PyObject *self, PyObject *args, PyObject *varargs) { PyObject *resultobj = 0; GPLogLevel arg1 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + char *arg2 = 0 ; + char *arg3 = 0 ; void *arg4 = 0 ; int val1 ; int ecode1 = 0 ; @@ -4659,7 +5007,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet LogFuncItem___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin__LogFuncItem_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"~LogFuncItem", &LogFuncItem___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &LogFuncItem___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -4672,7 +5020,7 @@ SwigPyBuiltin__LogFuncItem_richcompare(PyObject *self, PyObject *other, int op) SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -4740,7 +5088,7 @@ static PyHeapTypeObject SwigPyBuiltin__LogFuncItem_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -4889,6 +5237,9 @@ static PyHeapTypeObject SwigPyBuiltin__LogFuncItem_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -4912,7 +5263,6 @@ static PyTypeObject *SwigPyBuiltin__LogFuncItem_type_create(PyTypeObject *type, SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'LogFuncItem'."); return NULL; } return pytype; @@ -4920,78 +5270,14 @@ static PyTypeObject *SwigPyBuiltin__LogFuncItem_type_create(PyTypeObject *type, #else static PyTypeObject *SwigPyBuiltin__LogFuncItem_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_LogFuncItem_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_LogFuncItem_destructor_closure }, { Py_tp_doc, (void *)"::LogFuncItem" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin__LogFuncItem_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin__LogFuncItem_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin__LogFuncItem_methods }, { Py_tp_getset, (void *)SwigPyBuiltin__LogFuncItem_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -5002,10 +5288,15 @@ static PyTypeObject *SwigPyBuiltin__LogFuncItem_type_create(PyTypeObject *type, slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -5014,7 +5305,7 @@ SWIGINTERN SwigPyClientData SwigPyBuiltin__LogFuncItem_clientdata = {0, 0, 0, 0, static SwigPyGetSet Log___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin__Log_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"Log_add_func", &Log___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &Log___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -5027,7 +5318,7 @@ SwigPyBuiltin__Log_richcompare(PyObject *self, PyObject *other, int op) { SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -5039,7 +5330,7 @@ SwigPyBuiltin__Log_richcompare(PyObject *self, PyObject *other, int op) { SWIGINTERN PyMethodDef SwigPyBuiltin__Log_methods[] = { { "add_func", (PyCFunction)(void(*)(void))_wrap_Log_add_func, METH_STATIC|METH_VARARGS, "\n" - "Log_add_func(level, func, data) -> int\n" + "add_func(level, func, data) -> int\n" "\n" "Parameters\n" "----------\n" @@ -5105,7 +5396,7 @@ static PyHeapTypeObject SwigPyBuiltin__Log_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -5254,6 +5545,9 @@ static PyHeapTypeObject SwigPyBuiltin__Log_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -5277,7 +5571,6 @@ static PyTypeObject *SwigPyBuiltin__Log_type_create(PyTypeObject *type, PyTypeOb SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'Log'."); return NULL; } return pytype; @@ -5285,78 +5578,14 @@ static PyTypeObject *SwigPyBuiltin__Log_type_create(PyTypeObject *type, PyTypeOb #else static PyTypeObject *SwigPyBuiltin__Log_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)SwigPyBuiltin_BadDealloc }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) SwigPyBuiltin_BadDealloc }, { Py_tp_doc, (void *)"::Log" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin__Log_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin__Log_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin__Log_methods }, { Py_tp_getset, (void *)SwigPyBuiltin__Log_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -5367,10 +5596,15 @@ static PyTypeObject *SwigPyBuiltin__Log_type_create(PyTypeObject *type, PyTypeOb slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -5425,7 +5659,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -5440,15 +5674,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -5460,8 +5699,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -5479,6 +5781,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -5530,8 +5872,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -5557,48 +5900,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -5629,7 +6025,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -5637,13 +6032,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -5747,6 +6145,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -5758,21 +6158,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -5810,27 +6235,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -5849,19 +6278,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -5886,7 +6311,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -5902,15 +6329,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin__LogFuncItem_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin__LogFuncItem_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "LogFuncItem", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "LogFuncItem", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "LogFuncItem"); d = md; @@ -5922,25 +6348,20 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin__Log_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin__Log_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "Log", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "Log", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "Log"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_LOG_ERROR",SWIG_From_int((int)(GP_LOG_ERROR))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_LOG_VERBOSE",SWIG_From_int((int)(GP_LOG_VERBOSE))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_LOG_DEBUG",SWIG_From_int((int)(GP_LOG_DEBUG))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_LOG_DATA",SWIG_From_int((int)(GP_LOG_DATA))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/port_wrap.c b/src/swig-gp2_5_33/port_wrap.c index 51067a2..8e0dd0d 100644 --- a/src/swig-gp2_5_33/port_wrap.c +++ b/src/swig-gp2_5_33/port_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4030,9 +4378,6 @@ static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4157,7 +4502,7 @@ SWIGINTERN int _wrap_new_GPPort(PyObject *self, PyObject *args, PyObject *kwargs SWIGINTERN PyObject *_wrap_delete_GPPort(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPort *arg1 = (struct _GPPort *) 0 ; + struct _GPPort *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4180,7 +4525,7 @@ SWIGINTERN PyObject *_wrap_delete_GPPort(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPort_close(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPort *arg1 = (struct _GPPort *) 0 ; + struct _GPPort *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4203,8 +4548,8 @@ SWIGINTERN PyObject *_wrap_GPPort_close(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPort_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPort *arg1 = (struct _GPPort *) 0 ; - GPPortInfo *arg2 = (GPPortInfo *) 0 ; + struct _GPPort *arg1 = 0 ; + GPPortInfo *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GPPortInfo temp2 ; @@ -4236,7 +4581,7 @@ SWIGINTERN PyObject *_wrap_GPPort_get_info(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPort_open(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPort *arg1 = (struct _GPPort *) 0 ; + struct _GPPort *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4259,7 +4604,7 @@ SWIGINTERN PyObject *_wrap_GPPort_open(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPort_reset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPort *arg1 = (struct _GPPort *) 0 ; + struct _GPPort *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -4282,8 +4627,8 @@ SWIGINTERN PyObject *_wrap_GPPort_reset(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_GPPort_set_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _GPPort *arg1 = (struct _GPPort *) 0 ; - GPPortInfo arg2 = (GPPortInfo) 0 ; + struct _GPPort *arg1 = 0 ; + GPPortInfo arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -4316,7 +4661,7 @@ SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_GPPort) /* defines _wrap_delete_GPPort_de SWIGINTERN PyObject *_wrap_gp_port_new(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPort **arg1 = (GPPort **) 0 ; + GPPort **arg1 = 0 ; GPPort *temp1 ; int result; @@ -4339,8 +4684,8 @@ SWIGINTERN PyObject *_wrap_gp_port_new(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_port_set_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPort *arg1 = (GPPort *) 0 ; - GPPortInfo arg2 = (GPPortInfo) 0 ; + GPPort *arg1 = 0 ; + GPPortInfo arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -4370,8 +4715,8 @@ SWIGINTERN PyObject *_wrap_gp_port_set_info(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_port_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPort *arg1 = (GPPort *) 0 ; - GPPortInfo *arg2 = (GPPortInfo *) 0 ; + GPPort *arg1 = 0 ; + GPPortInfo *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; GPPortInfo temp2 ; @@ -4402,7 +4747,7 @@ SWIGINTERN PyObject *_wrap_gp_port_get_info(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_port_open(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPort *arg1 = (GPPort *) 0 ; + GPPort *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -4424,7 +4769,7 @@ SWIGINTERN PyObject *_wrap_gp_port_open(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_port_close(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPort *arg1 = (GPPort *) 0 ; + GPPort *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -4446,7 +4791,7 @@ SWIGINTERN PyObject *_wrap_gp_port_close(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_port_reset(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - GPPort *arg1 = (GPPort *) 0 ; + GPPort *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -4599,22 +4944,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet GPPort___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___GPPort_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"\n" - "_GPPort\n" - "The GPhoto port structure. \n" - "\n" - "This structure tracks the physical connection of the device. It can\n" - "correspond the various methods of lowlevel access, serial usb and others\n" - "and abstracts them as much as possible. \n" - "\n" - "Frontends should consider this structure opaque and only use accessor\n" - "functions. \n" - "\n" - "Camera drivers should only access the type and pl members directly, and\n" - "use accessor functions for the rest. \n" - "\n" - "C++ includes: gphoto2-port.h\n" - "", &GPPort___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &GPPort___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -4627,7 +4957,7 @@ SwigPyBuiltin___GPPort_richcompare(PyObject *self, PyObject *other, int op) { SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -4721,7 +5051,7 @@ static PyHeapTypeObject SwigPyBuiltin___GPPort_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ _wrap_new_GPPort, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -4870,6 +5200,9 @@ static PyHeapTypeObject SwigPyBuiltin___GPPort_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -4893,7 +5226,6 @@ static PyTypeObject *SwigPyBuiltin___GPPort_type_create(PyTypeObject *type, PyTy SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'GPPort'."); return NULL; } return pytype; @@ -4901,17 +5233,9 @@ static PyTypeObject *SwigPyBuiltin___GPPort_type_create(PyTypeObject *type, PyTy #else static PyTypeObject *SwigPyBuiltin___GPPort_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)_wrap_new_GPPort }, - { Py_tp_dealloc, (void *)_wrap_delete_GPPort_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) _wrap_new_GPPort }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_GPPort_destructor_closure }, { Py_tp_doc, (void *)"\n" "The GPhoto port structure. \n" "\n" @@ -4927,66 +5251,10 @@ static PyTypeObject *SwigPyBuiltin___GPPort_type_create(PyTypeObject *type, PyTy "\n" "C++ includes: gphoto2-port.h\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___GPPort_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___GPPort_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___GPPort_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___GPPort_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)(lenfunc) 0 }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)(ssizeargfunc) 0 }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, { 0, NULL } }; PyType_Spec spec = { @@ -4997,10 +5265,15 @@ static PyTypeObject *SwigPyBuiltin___GPPort_type_create(PyTypeObject *type, PyTy slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -5103,7 +5376,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -5118,15 +5391,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -5138,8 +5416,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -5157,6 +5498,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -5208,8 +5589,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -5235,48 +5617,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -5307,7 +5742,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -5315,13 +5749,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -5425,6 +5862,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -5436,21 +5875,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -5488,27 +5952,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -5527,19 +5995,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -5564,7 +6028,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -5589,15 +6055,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___GPPort_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___GPPort_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "GPPort", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "GPPort", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "GPPort"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_PIN_RTS",SWIG_From_int((int)(GP_PIN_RTS))); @@ -5608,10 +6073,6 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_PIN_RING",SWIG_From_int((int)(GP_PIN_RING))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_LEVEL_LOW",SWIG_From_int((int)(GP_LEVEL_LOW))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_LEVEL_HIGH",SWIG_From_int((int)(GP_LEVEL_HIGH))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/result.py b/src/swig-gp2_5_33/result.py index 12d6173..3ffbc33 100644 --- a/src/swig-gp2_5_33/result.py +++ b/src/swig-gp2_5_33/result.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._result import * else: from _result import * diff --git a/src/swig-gp2_5_33/result_wrap.c b/src/swig-gp2_5_33/result_wrap.c index 0bcf0b2..0694241 100644 --- a/src/swig-gp2_5_33/result_wrap.c +++ b/src/swig-gp2_5_33/result_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; + +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4014,9 +4362,6 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4086,6 +4431,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4203,7 +4551,7 @@ SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { if (carray) { - if (size > INT_MAX) { + if (size > (size_t)PY_SSIZE_T_MAX) { swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); return pchar_descriptor ? SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); @@ -4352,7 +4700,7 @@ static swig_const_info swig_const_table[] = { #endif /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -4367,15 +4715,20 @@ static swig_const_info swig_const_table[] = { * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -4387,8 +4740,71 @@ static swig_const_info swig_const_table[] = { * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -4406,6 +4822,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -4457,8 +4913,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -4484,48 +4941,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -4556,7 +5066,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -4564,13 +5073,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -4674,6 +5186,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -4685,21 +5199,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -4737,27 +5276,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -4776,19 +5319,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -4813,7 +5352,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -4854,10 +5395,6 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_ERROR_CAMERA_ERROR",SWIG_From_int((int)(-113))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_ERROR_OS_FAILURE",SWIG_From_int((int)(-114))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_ERROR_NO_SPACE",SWIG_From_int((int)(-115))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/version.py b/src/swig-gp2_5_33/version.py index 90b431a..fa14bfd 100644 --- a/src/swig-gp2_5_33/version.py +++ b/src/swig-gp2_5_33/version.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._version import * else: from _version import * diff --git a/src/swig-gp2_5_33/version_wrap.c b/src/swig-gp2_5_33/version_wrap.c index cf8f606..d01ecfd 100644 --- a/src/swig-gp2_5_33/version_wrap.c +++ b/src/swig-gp2_5_33/version_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; + +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4015,9 +4363,6 @@ static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2-version.h" @@ -4090,6 +4435,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4312,7 +4660,7 @@ static swig_const_info swig_const_table[] = { #endif /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -4327,15 +4675,20 @@ static swig_const_info swig_const_table[] = { * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -4347,8 +4700,71 @@ static swig_const_info swig_const_table[] = { * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -4366,6 +4782,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -4417,8 +4873,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -4444,48 +4901,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -4516,7 +5026,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -4524,13 +5033,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -4634,6 +5146,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -4645,21 +5159,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -4697,27 +5236,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -4736,19 +5279,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -4773,7 +5312,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -4782,10 +5323,6 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_VERSION_SHORT",SWIG_From_int((int)(GP_VERSION_SHORT))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_VERSION_VERBOSE",SWIG_From_int((int)(GP_VERSION_VERBOSE))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/src/swig-gp2_5_33/widget.py b/src/swig-gp2_5_33/widget.py index 87244bb..1a99bae 100644 --- a/src/swig-gp2_5_33/widget.py +++ b/src/swig-gp2_5_33/widget.py @@ -1,12 +1,12 @@ # This file was automatically generated by SWIG (https://www.swig.org). -# Version 4.3.1 +# Version 4.4.0 # # Do not make changes to this file unless you know what you are doing - modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info # Pull in all the attributes from the low-level C/C++ module -if __package__ or "." in __name__: +if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__: from ._widget import * else: from _widget import * diff --git a/src/swig-gp2_5_33/widget_wrap.c b/src/swig-gp2_5_33/widget_wrap.c index 5a0b14b..3bb6500 100644 --- a/src/swig-gp2_5_33/widget_wrap.c +++ b/src/swig-gp2_5_33/widget_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (https://www.swig.org). - * Version 4.3.1 + * Version 4.4.0 * * Do not make changes to this file unless you know what you are doing - modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ -#define SWIG_VERSION 0x040301 +#define SWIG_VERSION 0x040400 #define SWIGPYTHON #define SWIG_PYTHON_DIRECTOR_NO_VTABLE #define SWIGPYTHON_BUILTIN @@ -139,9 +139,9 @@ #endif #if defined(__cplusplus) && __cplusplus >=201103L -# define SWIG_NULLPTR nullptr +# define SWIG_NOEXCEPT noexcept #else -# define SWIG_NULLPTR NULL +# define SWIG_NOEXCEPT throw() #endif /* ----------------------------------------------------------------------------- @@ -205,14 +205,6 @@ # include #endif -#if defined(SWIGPYTHON_BUILTIN) && defined(SWIG_HEAPTYPES) -/* SWIG_HEAPTYPES is not ready for use with SWIGPYTHON_BUILTIN, but if turned on manually requires the following */ -#if PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030c0000 -#include -#define Py_READONLY READONLY -#define Py_T_PYSSIZET T_PYSSIZET -#endif -#endif #if __GNUC__ >= 7 #pragma GCC diagnostic pop @@ -230,7 +222,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "5" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -428,8 +420,8 @@ typedef struct swig_type_info { typedef struct swig_cast_info { swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ + struct swig_cast_info *next; /* pointer to next array of casts | pointer to cast hashed by value */ + unsigned int value; /* index of the last valid element in the array | typename hash value */ } swig_cast_info; /* Structure used to store module information @@ -490,55 +482,147 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } +/* + * Hash function for type name strings, based on maRushPrime1Hash (http://amsoftware.narod.ru/algo2.html) + */ +SWIGRUNTIME unsigned int SWIG_Hash(const char *str, unsigned int len) { + const unsigned char *data = (const unsigned char *)str; + unsigned int hash = len, i = 0, k; + int rem = (int)len; + + while (rem >= (int)sizeof(unsigned int)) { + k = *(unsigned int *)data; + k += i++; + hash ^= k; + hash *= 171717; + data += sizeof(unsigned int); + rem -= sizeof(unsigned int); + } + + switch (rem) { + case 3: k = (unsigned int)(data[2]) << 16; + k |= (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 2: k = (unsigned int)(data[1]) << 8; + k |= (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + case 1: k = (unsigned int)(data[0]); + k += i++; + hash ^= k; + hash *= 171717; + break; + } + return hash; +} + /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { + static const unsigned int scan_threshold = 4; if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + unsigned int hash_value = 0; + int hashed = 0; + + while (head) { + + if (strcmp(head->type->name, c) == 0) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + int search = 1; + + if (!hashed) { + if (head->value < scan_threshold) { + for (iter = first; iter <= last; iter++) { + if (strcmp(iter->type->name, c) == 0) { + return iter; + } + } + search = 0; + } else { + hashed = 1; + hash_value = SWIG_Hash(c, (unsigned int)strlen(c)); + } + } + + if (search) { + /* Binary search over sorted <'next'|'value'> pairs */ + do { + iter = first + ((last - first) >> 1); + if (iter->value < hash_value) { + first = iter + 1; + } else if (iter->value == hash_value) { + + if (strcmp(iter->next->type->name, c) == 0) { + return iter->next; + } + + /* Hash collision check */ + for (last = iter + 1; last->next && last->value == hash_value; last++) { + if (strcmp(last->next->type->name, c) == 0) { + return last->next; + } + } + for (first = iter - 1; first != head && first->value == hash_value; first--) { + if (strcmp(first->next->type->name, c) == 0) { + return first->next; + } + } + break; + } else + last = iter - 1; + } while (first <= last); + } + } + head = head->next; } } return 0; } /* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison + Check the type by type address */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; + swig_cast_info *head = ty->cast; + while (head) { + if (head->type == from) { + return head; } - iter = iter->next; + + if (head->value) { + swig_cast_info *iter; + swig_cast_info *last = head + head->value; + swig_cast_info *first = head + 1; + + /* Binary search over sorted array of casts */ + do { + iter = first + ((last - first) >> 1); + if (iter->type < from) { + first = iter + 1; + } else if (iter->type == from) { + return iter; + } else + last = iter - 1; + } while (first <= last); + } + head = head->next; } } return 0; @@ -601,20 +685,24 @@ SWIG_TypePrettyName(const swig_type_info *type) { */ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; + swig_cast_info *head = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + while (head) { + swig_cast_info *cast; + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } } } - cast = cast->next; + head = head->next; } } + SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); @@ -819,6 +907,12 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #define SWIG_NullReferenceError -13 +#if PY_VERSION_HEX >= 0x03030000 && !defined(SWIG_NO_HEAPTYPES) +#if !defined(SWIG_HEAPTYPES) +#define SWIG_HEAPTYPES +#endif +#endif + /* Compatibility macros for Python 3 */ #if PY_VERSION_HEX >= 0x03000000 @@ -846,6 +940,16 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { # define SWIG_Python_str_FromFormat PyString_FromFormat #endif +#if defined(SWIG_HEAPTYPES) +#if PY_VERSION_HEX < 0x030c0000 +#include +#define Py_READONLY READONLY +#define Py_T_PYSSIZET T_PYSSIZET +#endif +#endif + +#include /* For offsetof */ + /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */ SWIGINTERN const char * @@ -871,7 +975,7 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes #endif } -SWIGINTERN PyObject* +SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c) { #if PY_VERSION_HEX >= 0x03000000 @@ -881,6 +985,8 @@ SWIG_Python_str_FromChar(const char *c) #endif } +#define SWIG_RUNTIME_MODULE "swig_runtime_data" SWIG_RUNTIME_VERSION + /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */ # define SWIGPY_USE_CAPSULE #ifdef SWIGPYTHON_BUILTIN @@ -888,7 +994,7 @@ SWIG_Python_str_FromChar(const char *c) #else # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME #endif -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME) +#define SWIGPY_CAPSULE_NAME SWIG_RUNTIME_MODULE "." SWIGPY_CAPSULE_ATTR_NAME #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) @@ -896,7 +1002,7 @@ SWIG_Python_str_FromChar(const char *c) #define Py_hash_t long #endif -#ifdef Py_LIMITED_API +#if defined(Py_LIMITED_API) # define PyTuple_GET_ITEM PyTuple_GetItem /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */ @@ -923,6 +1029,90 @@ SWIG_Python_str_FromChar(const char *c) # define SWIG_Py_XDECREF Py_XDECREF #endif +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX < 0x030d00a6 +SWIGINTERN PyObject * +SWIG_PyType_GetFullyQualifiedName(PyTypeObject *type) { + PyObject *result = NULL; + PyObject *qualname = PyObject_GetAttrString((PyObject *)type, "__qualname__"); + if (qualname) { + PyObject *mod = PyObject_GetAttrString((PyObject *)type, "__module__"); + if (mod) { + if (PyUnicode_Check(mod) && PyUnicode_CompareWithASCIIString(mod, "builtins") && PyUnicode_CompareWithASCIIString(mod, "__main__")) { + result = PyUnicode_FromFormat("%U%c%U", mod, '.', qualname); + SWIG_Py_DECREF(qualname); + } else { + result = qualname; + } + SWIG_Py_DECREF(mod); + } else { + result = qualname; + } + } + + return result; +} +#else +# define SWIG_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName +#endif +#endif + +/* gh-114329 added PyList_GetItemRef() to Python 3.13.0a4 */ +#if PY_VERSION_HEX < 0x030d00a4 +SWIGINTERN PyObject * +SWIG_PyList_GetItemRef(PyObject *op, Py_ssize_t index) { + PyObject *item = PyList_GetItem(op, index); + Py_XINCREF(item); + return item; +} +#else +# define SWIG_PyList_GetItemRef PyList_GetItemRef +#endif + +/* gh-106004 added PyDict_GetItemRef() and PyDict_GetItemStringRef() to Python 3.13.0a1 + functions are renamed here for compatibility with abi3audit */ +#if PY_VERSION_HEX < 0x030d00a1 +SWIGINTERN int +SWIG_PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *item = PyDict_GetItemWithError(mp, key); +#else + PyObject *item = _PyDict_GetItemWithError(mp, key); +#endif + if (item != NULL) { + *result = (PyObject *)(item); + SWIG_Py_INCREF(*result); + return 1; + } + if (!PyErr_Occurred()) { + *result = NULL; + return 0; + } + *result = NULL; + return -1; +} + +SWIGINTERN int +SWIG_PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result) { + int res; +#if PY_VERSION_HEX >= 0x03000000 + PyObject *key_obj = PyUnicode_FromString(key); +#else + PyObject *key_obj = PyString_FromString(key); +#endif + if (key_obj == NULL) { + *result = NULL; + return -1; + } + res = SWIG_PyDict_GetItemRef(mp, key_obj, result); + Py_DECREF(key_obj); + return res; +} +#else +# define SWIG_PyDict_GetItemRef PyDict_GetItemRef +# define SWIG_PyDict_GetItemStringRef PyDict_GetItemStringRef +#endif + /* ----------------------------------------------------------------------------- * error manipulation * ----------------------------------------------------------------------------- */ @@ -1149,8 +1339,8 @@ typedef struct swig_const_info { # error "This version of SWIG only supports Python >= 2.7" #endif -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000 -# error "This version of SWIG only supports Python 3 >= 3.3" +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03050000 +# error "This version of SWIG only supports Python 3 >= 3.5" #endif /* Common SWIG API */ @@ -1201,7 +1391,6 @@ typedef struct swig_const_info { #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_fail goto fail - /* Runtime API implementation */ /* Error manipulation */ @@ -1252,8 +1441,31 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { #endif -/* Append a value to the result obj */ +/* SWIG runtime data Python module */ +static PyObject *Swig_runtime_data_module_global = NULL; +/* Create/obtain the single swig_runtime_data module which is used across different SWIG generated modules */ +SWIGINTERN PyObject * +SWIG_runtime_data_module(void) { + if (!Swig_runtime_data_module_global) { +#if PY_VERSION_HEX >= 0x030d0000 + /* free-threading note: the GIL is always enabled when this function is first called + by SWIG_init, so there's no risk of race conditions */ + Swig_runtime_data_module_global = PyImport_AddModuleRef(SWIG_RUNTIME_MODULE); +#elif PY_VERSION_HEX >= 0x03000000 + Swig_runtime_data_module_global = PyImport_AddModule(SWIG_RUNTIME_MODULE); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + Swig_runtime_data_module_global = Py_InitModule(SWIG_RUNTIME_MODULE, swig_empty_runtime_method_table); + SWIG_Py_XINCREF(Swig_runtime_data_module_global); +#endif + } + assert(Swig_runtime_data_module_global); + return Swig_runtime_data_module_global; +} + +/* Append a value to the result obj */ SWIGINTERN PyObject* SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { if (!result) { @@ -1378,7 +1590,7 @@ typedef struct swig_varlinkobject { } swig_varlinkobject; SWIGINTERN PyObject * -swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { +SwigVarLink_repr(PyObject *SWIGUNUSEDPARM(v)) { #if PY_VERSION_HEX >= 0x03000000 return PyUnicode_InternFromString(""); #else @@ -1387,7 +1599,7 @@ swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) { } SWIGINTERN PyObject * -swig_varlink_str(PyObject *o) { +SwigVarLink_str(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; #if PY_VERSION_HEX >= 0x03000000 PyObject *str = PyUnicode_InternFromString("("); @@ -1426,7 +1638,7 @@ swig_varlink_str(PyObject *o) { } SWIGINTERN void -swig_varlink_dealloc(PyObject *o) { +SwigVarLink_dealloc(PyObject *o) { swig_varlinkobject *v = (swig_varlinkobject *) o; swig_globalvar *var = v->vars; while (var) { @@ -1438,7 +1650,7 @@ swig_varlink_dealloc(PyObject *o) { } SWIGINTERN PyObject * -swig_varlink_getattr(PyObject *o, char *n) { +SwigVarLink_getattr(PyObject *o, char *n) { swig_varlinkobject *v = (swig_varlinkobject *) o; PyObject *res = NULL; swig_globalvar *var = v->vars; @@ -1456,7 +1668,7 @@ swig_varlink_getattr(PyObject *o, char *n) { } SWIGINTERN int -swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { +SwigVarLink_setattr(PyObject *o, char *n, PyObject *p) { swig_varlinkobject *v = (swig_varlinkobject *) o; int res = 1; swig_globalvar *var = v->vars; @@ -1473,13 +1685,9 @@ swig_varlink_setattr(PyObject *o, char *n, PyObject *p) { return res; } -#if !defined(SWIGPYTHON_BUILTIN) && PY_VERSION_HEX >= 0x03030000 -#define SWIG_HEAPTYPES -#endif - SWIGINTERN PyTypeObject* -swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; +SwigVarLink_TypeOnce(void) { + static char SwigVarLink_doc[] = "Swig variable link object"; #ifndef SWIG_HEAPTYPES static PyTypeObject varlink_type; static int type_init = 0; @@ -1491,30 +1699,30 @@ swig_varlink_type(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "swigvarlink", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigVarLink", /* tp_name */ sizeof(swig_varlinkobject), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (destructor) SwigVarLink_dealloc, /* tp_dealloc */ #if PY_VERSION_HEX < 0x030800b4 (printfunc)0, /* tp_print */ #else (Py_ssize_t)0, /* tp_vectorcall_offset */ #endif - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + (getattrfunc) SwigVarLink_getattr, /* tp_getattr */ + (setattrfunc) SwigVarLink_setattr, /* tp_setattr */ 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ + (reprfunc) SwigVarLink_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ + (reprfunc) SwigVarLink_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ + SwigVarLink_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -1545,37 +1753,50 @@ swig_varlink_type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); varlink_type = tmp; type_init = 1; if (PyType_Ready(&varlink_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigVarLink", (PyObject *)&varlink_type) == 0) + SWIG_Py_INCREF((PyObject *)&varlink_type); } return &varlink_type; #else PyType_Slot slots[] = { - { Py_tp_dealloc, (void *)swig_varlink_dealloc }, - { Py_tp_repr, (void *)swig_varlink_repr }, - { Py_tp_getattr, (void *)swig_varlink_getattr }, - { Py_tp_setattr, (void *)swig_varlink_setattr }, - { Py_tp_str, (void *)swig_varlink_str }, - { Py_tp_doc, (void *)varlink__doc__ }, + { Py_tp_dealloc, (void *)SwigVarLink_dealloc }, + { Py_tp_repr, (void *)SwigVarLink_repr }, + { Py_tp_getattr, (void *)SwigVarLink_getattr }, + { Py_tp_setattr, (void *)SwigVarLink_setattr }, + { Py_tp_str, (void *)SwigVarLink_str }, + { Py_tp_doc, (void *)SwigVarLink_doc }, { 0, NULL } }; PyType_Spec spec = { - "swigvarlink", + SWIG_RUNTIME_MODULE ".SwigVarLink", sizeof(swig_varlinkobject), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigVarLink", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } +SWIGRUNTIME PyTypeObject* +SwigVarLink_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigVarLink_TypeOnce(); + return type; +} + /* Create a variable linking object for use later */ SWIGINTERN PyObject * SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type()); + swig_varlinkobject *result = PyObject_New(swig_varlinkobject, SwigVarLink_Type()); if (result) { result->vars = 0; } @@ -1739,9 +1960,8 @@ typedef struct { swig_type_info *ty; int own; PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif + PyObject *swigdict; + PyObject *weakreflist; } SwigPyObject; @@ -1752,11 +1972,11 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)v; - if (!sobj->dict) - sobj->dict = PyDict_New(); + if (!sobj->swigdict) + sobj->swigdict = PyDict_New(); - SWIG_Py_XINCREF(sobj->dict); - return sobj->dict; + SWIG_Py_XINCREF(sobj->swigdict); + return sobj->swigdict; } #endif @@ -1829,7 +2049,7 @@ SwigPyObject_repr(SwigPyObject *v) } /* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ + * PyCFunction to use in SwigPyObject_methods[]. */ SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) { @@ -1837,26 +2057,33 @@ SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) } SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +SwigPyObject_compare(PyObject *v, PyObject *w) { - void *i = v->ptr; - void *j = w->ptr; + /* tp_compare is only called when both objects have the same type, so + * the casts are guaranteed to be ok. */ + void *i = ((SwigPyObject *)v)->ptr; + void *j = ((SwigPyObject *)w)->ptr; return (i < j) ? -1 : ((i > j) ? 1 : 0); } +SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *); + /* Added for Python 3.x, would it also be useful for Python 2.x? */ SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +SwigPyObject_richcompare(PyObject *v, PyObject *w, int op) { PyObject* res = NULL; if (!PyErr_Occurred()) { - if (op != Py_EQ && op != Py_NE) { + /* Per https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare + * the first argument is guaranteed to be an instance of SwigPyObject, but the + * second is not, so we typecheck that one. */ + if ((op != Py_EQ && op != Py_NE) || !SwigPyObject_Check(w)) { SWIG_Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); } - return res; + return res; } @@ -1865,7 +2092,7 @@ SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); #ifdef SWIGPYTHON_BUILTIN static swig_type_info *SwigPyObject_stype = 0; SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { SwigPyClientData *cd; assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; @@ -1875,7 +2102,7 @@ SwigPyObject_type(void) { } #else SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { +SwigPyObject_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); return type; } @@ -1883,29 +2110,29 @@ SwigPyObject_type(void) { SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op) { - PyTypeObject *target_tp = SwigPyObject_type(); + PyTypeObject *target_tp = SwigPyObject_Type(); PyTypeObject *op_type = Py_TYPE(op); #ifdef SWIGPYTHON_BUILTIN - if (PyType_IsSubtype(op_type, target_tp)) + /* Only builtin types have SwigPyObject as a base type */ + return PyType_IsSubtype(op_type, target_tp); +#else + /* Check for an exact match to SwigPyObject */ + if (op_type == target_tp) { return 1; - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyObject"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else -# ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyObject") == 0; #endif - if (op_type == target_tp) - return 1; -# ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; -# else - return (strcmp(op_type->tp_name, "SwigPyObject") == 0); -# endif + } #endif } @@ -1967,9 +2194,7 @@ SwigPyObject_dealloc(PyObject *v) SWIG_Py_XDECREF(Swig_Capsule_global); } SWIG_Py_XDECREF(next); -#ifdef SWIGPYTHON_BUILTIN - SWIG_Py_XDECREF(sobj->dict); -#endif + SWIG_Py_XDECREF(sobj->swigdict); PyObject_Free(v); } @@ -2036,7 +2261,7 @@ SwigPyObject_own(PyObject *v, PyObject *args) } static PyMethodDef -swigobject_methods[] = { +SwigPyObject_methods[] = { {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, @@ -2048,7 +2273,7 @@ swigobject_methods[] = { SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyObject_doc[] = "Swig object holding a C/C++ pointer"; #ifndef SWIG_HEAPTYPES static PyNumberMethods SwigPyObject_as_number = { (binaryfunc)0, /*nb_add*/ @@ -2104,7 +2329,7 @@ SwigPyObject_TypeOnce(void) { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyObject", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObject", /* tp_name */ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ @@ -2131,14 +2356,14 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ + SwigPyObject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ + offsetof(SwigPyObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ + SwigPyObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ @@ -2181,46 +2406,69 @@ SwigPyObject_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobject_type = tmp; type_init = 1; if (PyType_Ready(&swigpyobject_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObject", (PyObject *)&swigpyobject_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobject_type); } return &swigpyobject_type; #else + static PyMemberDef SwigPyObject_members[] = { + { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, swigdict), Py_READONLY, NULL }, + { (char *)"__weaklistoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, weakreflist), Py_READONLY, NULL }, + { NULL, 0, 0, 0, NULL } + }; PyType_Slot slots[] = { { Py_tp_dealloc, (void *)SwigPyObject_dealloc }, { Py_tp_repr, (void *)SwigPyObject_repr }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigobject_doc }, + { Py_tp_doc, (void *)SwigPyObject_doc }, { Py_tp_richcompare, (void *)SwigPyObject_richcompare }, - { Py_tp_methods, (void *)swigobject_methods }, + { Py_tp_methods, (void *)SwigPyObject_methods }, { Py_nb_int, (void *)SwigPyObject_long }, + { Py_tp_members, (void *)SwigPyObject_members }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyObject", + SWIG_RUNTIME_MODULE ".SwigPyObject", sizeof(SwigPyObject), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); +#if !defined(Py_LIMITED_API) +/* While this __dictoffset__ is only used with the builtin wrappers, SwigPyObject ought to be + identical when created for use by proxy class wrappers in case it is shared across multiple modules. */ +#if PY_VERSION_HEX < 0x03090000 + /* Workaround as __dictoffset__ and __weaklistoffset__ above are only supported from python-3.9 */ + if (pytype) { + ((PyTypeObject *)pytype)->tp_dictoffset = offsetof(SwigPyObject, swigdict); + ((PyTypeObject *)pytype)->tp_weaklistoffset = offsetof(SwigPyObject, weakreflist); + } +#endif +#endif + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObject", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own) { - SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type()); + SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_Type()); if (sobj) { sobj->ptr = ptr; sobj->ty = ty; sobj->own = own; sobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - sobj->dict = 0; -#endif + sobj->swigdict = 0; + sobj->weakreflist = 0; if (own == SWIG_POINTER_OWN) { /* Obtain a reference to the Python capsule wrapping the module information, so that the * module information is correctly destroyed after all SWIG python objects have been freed @@ -2276,30 +2524,32 @@ SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { +SwigPyPacked_Type(void) { static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); return type; } SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op) { -#ifdef Py_LIMITED_API - int cmp; - PyObject *tp_name; -#endif - PyTypeObject* op_type = Py_TYPE(op); - if (op_type == SwigPyPacked_TypeOnce()) + PyTypeObject *target_tp = SwigPyPacked_Type(); + PyTypeObject *op_type = Py_TYPE(op); + /* Check for an exact match to SwigPyPacked */ + if (op_type == target_tp) { return 1; -#ifdef Py_LIMITED_API - tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__"); - if (!tp_name) - return 0; - cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked"); - SWIG_Py_DECREF(tp_name); - return cmp == 0; + } else { + /* Fallback for multiple modules */ +#if PY_VERSION_HEX >= 0x03000000 + int cmp; + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(op_type); + if (!tpname) + return 0; + cmp = PyUnicode_CompareWithASCIIString(tpname, SWIG_RUNTIME_MODULE ".SwigPyPacked"); + SWIG_Py_DECREF(tpname); + return cmp == 0; #else - return (strcmp(op_type->tp_name, "SwigPyPacked") == 0); + return strcmp(op_type->tp_name, SWIG_RUNTIME_MODULE ".SwigPyPacked") == 0; #endif + } } SWIGRUNTIME void @@ -2314,19 +2564,19 @@ SwigPyPacked_dealloc(PyObject *v) SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static char SwigPyPacked_doc[] = "Swig object holding a C/C++ function pointer"; #ifndef SWIG_HEAPTYPES static PyTypeObject swigpypacked_type; static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ #endif - "SwigPyPacked", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyPacked", /* tp_name */ sizeof(SwigPyPacked), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ @@ -2337,7 +2587,7 @@ SwigPyPacked_TypeOnce(void) { #endif (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 0, /* tp_reserved in 3.0.1 */ #else (cmpfunc)SwigPyPacked_compare, /* tp_compare */ @@ -2353,7 +2603,7 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ + SwigPyPacked_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -2403,10 +2653,13 @@ SwigPyPacked_TypeOnce(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpypacked_type = tmp; type_init = 1; if (PyType_Ready(&swigpypacked_type) != 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyPacked", (PyObject *)&swigpypacked_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpypacked_type); } return &swigpypacked_type; #else @@ -2415,24 +2668,28 @@ SwigPyPacked_TypeOnce(void) { { Py_tp_repr, (void *)SwigPyPacked_repr }, { Py_tp_str, (void *)SwigPyPacked_str }, { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, - { Py_tp_doc, (void *)swigpacked_doc }, + { Py_tp_doc, (void *)SwigPyPacked_doc }, { 0, NULL } }; PyType_Spec spec = { - "SwigPyPacked", + SWIG_RUNTIME_MODULE ".SwigPyPacked", sizeof(SwigPyPacked), 0, Py_TPFLAGS_DEFAULT, slots }; - return (PyTypeObject *)PyType_FromSpec(&spec); + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyPacked", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; #endif } SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) { - SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type()); + SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_Type()); if (sobj) { void *pack = malloc(size); if (pack) { @@ -2478,10 +2735,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ /* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #define SWIG_PYTHON_SLOW_GETSET_THIS #endif +/* Returns a borrowed reference to the 'this' object */ SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -2492,18 +2750,18 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) #ifdef SWIGPYTHON_BUILTIN (void)obj; -# ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { #if PY_VERSION_HEX >= 0x030d0000 - PyWeakref_GetRef(pyobj, &pyobj); - Py_DECREF(pyobj); + if (PyWeakref_GetRef(pyobj, &pyobj) > 0) + Py_DECREF(pyobj); + else + pyobj = NULL; #else - pyobj = PyWeakref_GET_OBJECT(pyobj); + pyobj = PyWeakref_GetObject(pyobj); #endif if (pyobj && SwigPyObject_Check(pyobj)) return (SwigPyObject*) pyobj; } -# endif return NULL; #else @@ -2518,13 +2776,11 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) PyObject *dict = *dictptr; obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; } else { -#ifdef PyWeakref_CheckProxy if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2534,7 +2790,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) } } #else - obj = PyObject_GetAttr(pyobj,SWIG_This()); + obj = PyObject_GetAttr(pyobj, SWIG_This()); if (obj) { SWIG_Py_DECREF(obj); } else { @@ -2875,17 +3131,15 @@ SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int f newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif + newobj->swigdict = 0; + newobj->weakreflist = 0; } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN if (newobj) { - newobj->dict = 0; + newobj->swigdict = 0; + newobj->weakreflist = 0; } -#endif } if (newobj) { newobj->ptr = ptr; @@ -2953,6 +3207,12 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { } +#if defined(SWIG_REFCNT_DEBUG) +#define SWIG_PYOBJ_REFCNT(OBJ) fprintf(stdout, "" #OBJ " count %ld\n", (OBJ ? Py_REFCNT(OBJ) : 0)) +#else +#define SWIG_PYOBJ_REFCNT(OBJ) +#endif + static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */ SWIGRUNTIME void @@ -2963,7 +3223,7 @@ SWIG_Python_DestroyModule(PyObject *obj) size_t i; if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */ return; - for (i =0; i < swig_module->size; ++i) { + for (i = 0; i < swig_module->size; ++i) { swig_type_info *ty = types[i]; if (ty->owndata) { SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; @@ -2971,27 +3231,32 @@ SWIG_Python_DestroyModule(PyObject *obj) if (data) SwigPyClientData_Del(data); } } - SWIG_Py_DECREF(SWIG_This()); + SWIG_PYOBJ_REFCNT(Swig_This_global); + SWIG_Py_XDECREF(Swig_This_global); Swig_This_global = NULL; - SWIG_Py_DECREF(SWIG_globals()); + + SWIG_PYOBJ_REFCNT(Swig_Globals_global); + SWIG_Py_XDECREF(Swig_Globals_global); Swig_Globals_global = NULL; - SWIG_Py_DECREF(SWIG_Python_TypeCache()); + + SWIG_PYOBJ_REFCNT(Swig_TypeCache_global); + SWIG_Py_XDECREF(Swig_TypeCache_global); Swig_TypeCache_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_Capsule_global); Swig_Capsule_global = NULL; + + SWIG_PYOBJ_REFCNT(Swig_runtime_data_module_global); + SWIG_Py_XDECREF(Swig_runtime_data_module_global); + Swig_runtime_data_module_global = NULL; } SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif + PyObject *runtime_data_module = SWIG_runtime_data_module(); PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { + if (pointer && runtime_data_module) { + if (PyModule_AddObject(runtime_data_module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) { ++interpreter_counter; Swig_Capsule_global = pointer; } else { @@ -3005,10 +3270,10 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *obj; + SWIG_PyDict_GetItemStringRef(cache, type, &obj); if (obj) { descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); } else { @@ -3016,13 +3281,10 @@ SWIG_Python_TypeQuery(const char *type) descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); if (descriptor) { obj = PyCapsule_New((void*) descriptor, NULL, NULL); - if (obj) { - PyDict_SetItem(cache, key, obj); - SWIG_Py_DECREF(obj); - } + if (obj) PyDict_SetItemString(cache, type, obj); } } - SWIG_Py_DECREF(key); + SWIG_Py_XDECREF(obj); return descriptor; } @@ -3083,49 +3345,6 @@ SwigPyObject_GetDesc(PyObject *self) return ty ? ty->str : ""; } -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - (void) obj; - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { -#ifndef Py_LIMITED_API - /* tp_name is not accessible */ - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - PyObject *bytes = NULL; - const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - SWIG_Py_XDECREF(bytes); - SWIG_Py_XDECREF(str); - return; - } -#endif - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - /* Convert a pointer value, signal an exception on a type mismatch */ SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { @@ -3139,7 +3358,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(arg #ifdef SWIGPYTHON_BUILTIN SWIGRUNTIME int SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; PyObject *encoded_name; descrsetfunc f; @@ -3155,7 +3374,13 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!PyString_Check(name)) # endif { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(name)); + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%s'", Py_TYPE(name)->tp_name); +#endif return -1; } else { SWIG_Py_INCREF(name); @@ -3169,7 +3394,7 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) - f = descr->ob_type->tp_descr_set; + f = Py_TYPE(descr)->tp_descr_set; if (!f) { if (PyString_Check(name)) { encoded_name = name; @@ -3179,7 +3404,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { if (!encoded_name) goto done; } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); +#if PY_VERSION_HEX >= 0x03000000 + { + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(tp); + PyErr_Format(PyExc_AttributeError, "'%S' object has no attribute '%s'", tpname, PyString_AsString(encoded_name)); + SWIG_Py_DECREF(tpname); + } +#else + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", tp->tp_name, PyString_AsString(encoded_name)); +#endif SWIG_Py_DECREF(encoded_name); } else { res = f(descr, obj, value); @@ -3230,7 +3463,13 @@ SWIG_PyNumber_AsPyHash(PyObject *obj) { SWIGINTERN int SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(self)); + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%s'", Py_TYPE(self)->tp_name); +#endif return -1; } @@ -3238,7 +3477,13 @@ SWIGINTERN void SwigPyBuiltin_BadDealloc(PyObject *obj) { SwigPyObject *sobj = (SwigPyObject *)obj; if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%S': no callable destructor found.", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%s': no callable destructor found.", Py_TYPE(obj)->tp_name); +#endif } } @@ -3281,12 +3526,28 @@ SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { SwigPyGetSet *getset; PyObject *tuple, *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } tuple = PyTuple_New(1); @@ -3304,12 +3565,28 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) SwigPyGetSet *getset; PyObject *result; if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); + PyErr_Format(PyExc_AttributeError, "Missing getset closure"); + return -1; + } + if (!val) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable deletion in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } getset = (SwigPyGetSet *)closure; if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); +#if PY_VERSION_HEX >= 0x03000000 + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(Py_TYPE(obj)); + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%S'", tpname); + SWIG_Py_DECREF(tpname); +#else + PyErr_Format(PyExc_AttributeError, "Illegal member variable assignment in type '%s'", Py_TYPE(obj)->tp_name); +#endif return -1; } result = (*getset->set)(obj, val); @@ -3328,7 +3605,6 @@ SwigPyStaticVar_dealloc(PyDescrObject *descr) { SWIGINTERN PyObject * SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { #if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromFormat("", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else return PyString_FromFormat("", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); @@ -3348,9 +3624,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU 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 '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return NULL; } @@ -3360,9 +3636,9 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) 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 '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%S' of '%s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); #else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); + PyErr_Format(PyExc_AttributeError, "attribute '%s' of '%s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); #endif return -1; } @@ -3371,26 +3647,31 @@ SWIGINTERN int SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { PyObject *attribute; PyTypeObject *type; - descrsetfunc local_set; assert(PyType_Check(typeobject)); type = (PyTypeObject *)typeobject; attribute = _PyType_Lookup(type, name); if (attribute != NULL) { /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); + descrsetfunc local_set = Py_TYPE(attribute)->tp_descr_set; + if (local_set == NULL) { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%S.%S'", tpname, name); + SWIG_Py_DECREF(tpname); #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 '%s.%s'", type->tp_name, PyString_AS_STRING(name)); #endif + } else { + return local_set(attribute, (PyObject *)type, value); + } } else { #if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); + PyObject *tpname = SWIG_PyType_GetFullyQualifiedName(type); + PyErr_Format(PyExc_AttributeError, "type '%S' has no attribute '%S'", tpname, name); + SWIG_Py_DECREF(tpname); #else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); + PyErr_Format(PyExc_AttributeError, "type '%s' has no attribute '%s'", type->tp_name, PyString_AS_STRING(name)); #endif } @@ -3398,7 +3679,9 @@ SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) } SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { +SwigPyStaticVar_TypeOnce(void) { + static char SwigPyStaticVar_doc[] = "Swig member static variables"; +#ifndef SWIG_HEAPTYPES static PyTypeObject staticvar_type; static int type_init = 0; if (!type_init) { @@ -3409,7 +3692,7 @@ SwigPyStaticVar_Type(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "swig_static_var_getset_descriptor", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", /* tp_name */ sizeof(PyGetSetDescrObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ @@ -3432,7 +3715,7 @@ SwigPyStaticVar_Type(void) { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ + SwigPyStaticVar_doc, /* tp_doc */ SwigPyStaticVar_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3482,17 +3765,51 @@ SwigPyStaticVar_Type(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); staticvar_type = tmp; type_init = 1; if (PyType_Ready(&staticvar_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", (PyObject *)&staticvar_type) == 0) + SWIG_Py_INCREF((PyObject *)&staticvar_type); } return &staticvar_type; +#else + PyType_Slot slots[] = { + { Py_tp_doc, (void *)SwigPyStaticVar_doc}, + { Py_tp_dealloc, (void *)(destructor)SwigPyStaticVar_dealloc }, + { Py_tp_repr, (void *)(reprfunc)SwigPyStaticVar_repr }, + { Py_tp_getattro, (void *)PyObject_GenericGetAttr }, + { Py_tp_traverse, (void *)SwigPyStaticVar_traverse }, + { Py_tp_descr_get, (void *)(descrgetfunc)SwigPyStaticVar_get }, + { Py_tp_descr_set, (void *)(descrsetfunc)SwigPyStaticVar_set }, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyStaticVar", + sizeof(PyGetSetDescrObject), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyStaticVar", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyStaticVar_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyStaticVar_TypeOnce(); + return type; } SWIGINTERN PyTypeObject* -SwigPyObjectType(void) { - static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; +SwigPyObjectType_TypeOnce(void) { + static char SwigPyObjectType_doc[] = "Metaclass for SWIG wrapped types"; +#ifndef SWIG_HEAPTYPES static PyTypeObject swigpyobjecttype_type; static int type_init = 0; if (!type_init) { @@ -3503,7 +3820,7 @@ SwigPyObjectType(void) { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ #endif - "SwigPyObjectType", /* tp_name */ + SWIG_RUNTIME_MODULE ".SwigPyObjectType", /* tp_name */ PyType_Type.tp_basicsize, /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -3526,7 +3843,7 @@ SwigPyObjectType(void) { SwigPyObjectType_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - swigpyobjecttype_doc, /* tp_doc */ + SwigPyObjectType_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -3576,13 +3893,42 @@ SwigPyObjectType(void) { 0 /* tp_next */ #endif }; + PyObject *runtime_data_module = SWIG_runtime_data_module(); swigpyobjecttype_type = tmp; type_init = 1; swigpyobjecttype_type.tp_base = &PyType_Type; if (PyType_Ready(&swigpyobjecttype_type) < 0) return NULL; + if (PyModule_AddObject(runtime_data_module, "SwigPyObjectType", (PyObject *)&swigpyobjecttype_type) == 0) + SWIG_Py_INCREF((PyObject *)&swigpyobjecttype_type); } return &swigpyobjecttype_type; +#else + PyType_Slot slots[] = { + { Py_tp_setattro, (void *)SwigPyObjectType_setattro }, + { Py_tp_doc, (void *)SwigPyObjectType_doc}, + { Py_tp_base, (void *)&PyType_Type}, + { 0, NULL } + }; + PyType_Spec spec = { + SWIG_RUNTIME_MODULE ".SwigPyObjectType", + (int)PyType_Type.tp_basicsize, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, + slots + }; + PyObject *pytype = PyType_FromSpec(&spec); + PyObject *runtime_data_module = SWIG_runtime_data_module(); + if (pytype && PyModule_AddObject(runtime_data_module, "SwigPyObjectType", pytype) == 0) + SWIG_Py_INCREF(pytype); + return (PyTypeObject *)pytype; +#endif +} + +SWIGRUNTIME PyTypeObject * +SwigPyObjectType_Type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObjectType_TypeOnce(); + return type; } SWIGINTERN PyGetSetDescrObject * @@ -3610,7 +3956,7 @@ SwigPyBuiltin_InitBases(PyTypeObject **bases) { Py_ssize_t i; if (!bases[0]) { - bases[0] = SwigPyObject_type(); + bases[0] = SwigPyObject_Type(); bases[1] = NULL; } for (b = bases; *b != NULL; ++b) @@ -3632,12 +3978,12 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { } SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +SwigPyBuiltin_SetMetaType(PyTypeObject *type, PyTypeObject *metatype) { #if PY_VERSION_HEX >= 0x030900a4 - Py_SET_TYPE(type, metatype); + Py_SET_TYPE((PyObject *)type, metatype); #else - Py_TYPE(type) = metatype; + Py_TYPE(type) = metatype; #endif } @@ -3665,7 +4011,9 @@ SWIGINTERN void SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { SwigPyObject *sobj; sobj = (SwigPyObject *)a; - SWIG_Py_XDECREF(sobj->dict); + if (sobj->weakreflist != NULL) + PyObject_ClearWeakRefs(a); + SWIG_Py_XDECREF(sobj->swigdict); if (sobj->own) { PyObject *o; PyObject *type = 0, *value = 0, *traceback = 0; @@ -3679,7 +4027,7 @@ SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrap PyErr_Restore(type, value, traceback); SWIG_Py_XDECREF(o); } - if (PyType_IS_GC(a->ob_type)) { + if (PyType_IS_GC(Py_TYPE(a))) { PyObject_GC_Del(a); } else { PyObject_Free(a); @@ -4021,9 +4369,6 @@ static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include - - #include "gphoto2/gphoto2.h" @@ -4149,6 +4494,9 @@ SWIG_AsVal_double (PyObject *obj, double *val) } +#include + + #include @@ -4338,7 +4686,7 @@ SWIG_pchar_descriptor(void) SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) { -#if PY_VERSION_HEX>=0x03000000 +#if PY_VERSION_HEX >= 0x03000000 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_Check(obj)) #else @@ -4353,7 +4701,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) int ret = SWIG_OK; if (alloc) *alloc = SWIG_OLDOBJ; -#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#if PY_VERSION_HEX >= 0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) return SWIG_TypeError; #else @@ -4380,7 +4728,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" #endif -#if PY_VERSION_HEX<0x03000000 +#if PY_VERSION_HEX < 0x03000000 if (PyUnicode_Check(obj)) { char *cstr; Py_ssize_t len; if (!alloc && cptr) { @@ -4853,8 +5201,8 @@ extern "C" { #endif SWIGINTERN PyObject *_wrap_gp_widget_get_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - void *arg2 = (void *) 0 ; + CameraWidget *arg1 = 0 ; + void *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; VoidValue temp2 ; @@ -4916,8 +5264,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_value(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_children(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; + CameraWidget *arg1 = 0 ; + PyObject **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *temp2 = NULL ; @@ -4948,8 +5296,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_children(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_gp_widget_get_choices(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; + CameraWidget *arg1 = 0 ; + PyObject **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *temp2 = NULL ; @@ -4980,7 +5328,7 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_choices(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_delete_CameraWidget(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -5003,9 +5351,9 @@ SWIGINTERN PyObject *_wrap_delete_CameraWidget(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraWidget___getitem__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; int arg2 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5064,7 +5412,7 @@ SWIGINTERN PyObject *_wrap_CameraWidget___getitem__(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_CameraWidget___len__(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5088,7 +5436,7 @@ SWIGINTERN PyObject *_wrap_CameraWidget___len__(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_count_children(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -5112,9 +5460,9 @@ SWIGINTERN PyObject *_wrap_CameraWidget_count_children(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraWidget_get_child(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; int arg2 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5173,8 +5521,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_child(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraWidget_get_children(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; + struct _CameraWidget *arg1 = 0 ; + PyObject **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *temp2 = NULL ; @@ -5206,9 +5554,9 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_children(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_CameraWidget_get_child_by_label(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + struct _CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5270,9 +5618,9 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_child_by_label(PyObject *self, PyObj SWIGINTERN PyObject *_wrap_CameraWidget_get_child_by_id(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; int arg2 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -5331,9 +5679,9 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_child_by_id(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_CameraWidget_get_child_by_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + struct _CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5395,8 +5743,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_child_by_name(PyObject *self, PyObje SWIGINTERN PyObject *_wrap_CameraWidget_get_root(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - CameraWidget **arg2 = (CameraWidget **) 0 ; + struct _CameraWidget *arg1 = 0 ; + CameraWidget **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidget *temp2 ; @@ -5447,8 +5795,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_root(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_get_parent(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - CameraWidget **arg2 = (CameraWidget **) 0 ; + struct _CameraWidget *arg1 = 0 ; + CameraWidget **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidget *temp2 ; @@ -5499,8 +5847,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_parent(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_CameraWidget_set_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - void *arg2 = (void *) 0 ; + struct _CameraWidget *arg1 = 0 ; + void *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; VoidValue value2 ; @@ -5572,8 +5920,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_set_value(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraWidget_get_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - void *arg2 = (void *) 0 ; + struct _CameraWidget *arg1 = 0 ; + void *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; VoidValue temp2 ; @@ -5636,8 +5984,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_value(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraWidget_set_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5675,8 +6023,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_set_name(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char **arg2 = (char **) 0 ; + struct _CameraWidget *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -5708,8 +6056,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_name(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_set_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -5747,8 +6095,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_set_info(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char **arg2 = (char **) 0 ; + struct _CameraWidget *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -5780,8 +6128,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_info(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_get_id(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - int *arg2 = (int *) 0 ; + struct _CameraWidget *arg1 = 0 ; + int *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int temp2 ; @@ -5813,8 +6161,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_id(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_CameraWidget_get_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - CameraWidgetType *arg2 = (CameraWidgetType *) 0 ; + struct _CameraWidget *arg1 = 0 ; + CameraWidgetType *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidgetType temp2 ; @@ -5846,8 +6194,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_type(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_get_label(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char **arg2 = (char **) 0 ; + struct _CameraWidget *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -5879,7 +6227,7 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_label(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraWidget_set_range(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; float arg2 ; float arg3 ; float arg4 ; @@ -5933,10 +6281,10 @@ SWIGINTERN PyObject *_wrap_CameraWidget_set_range(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraWidget_get_range(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - float *arg2 = (float *) 0 ; - float *arg3 = (float *) 0 ; - float *arg4 = (float *) 0 ; + struct _CameraWidget *arg1 = 0 ; + float *arg2 = 0 ; + float *arg3 = 0 ; + float *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; float temp2 ; @@ -5986,8 +6334,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_range(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_CameraWidget_add_choice(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; + struct _CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6025,7 +6373,7 @@ SWIGINTERN PyObject *_wrap_CameraWidget_add_choice(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_CameraWidget_count_choices(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -6049,8 +6397,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_count_choices(PyObject *self, PyObject * SWIGINTERN PyObject *_wrap_CameraWidget_get_choices(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; + struct _CameraWidget *arg1 = 0 ; + PyObject **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *temp2 = NULL ; @@ -6082,9 +6430,9 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_choices(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_CameraWidget_get_choice(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; int arg2 ; - char **arg3 = (char **) 0 ; + char **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -6124,7 +6472,7 @@ SWIGINTERN PyObject *_wrap_CameraWidget_get_choice(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_CameraWidget_changed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int result; @@ -6148,7 +6496,7 @@ SWIGINTERN PyObject *_wrap_CameraWidget_changed(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_CameraWidget_set_changed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -6180,7 +6528,7 @@ SWIGINTERN PyObject *_wrap_CameraWidget_set_changed(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_CameraWidget_set_readonly(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; + struct _CameraWidget *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -6216,8 +6564,8 @@ SWIGINTERN PyObject *_wrap_CameraWidget_set_readonly(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_CameraWidget_get_readonly(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - struct _CameraWidget *arg1 = (struct _CameraWidget *) 0 ; - int *arg2 = (int *) 0 ; + struct _CameraWidget *arg1 = 0 ; + int *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int temp2 ; @@ -6255,8 +6603,8 @@ SWIGPY_LENFUNC_CLOSURE(_wrap_CameraWidget___len__) /* defines _wrap_CameraWidget SWIGINTERN PyObject *_wrap_gp_widget_append(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - CameraWidget *arg2 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; + CameraWidget *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -6286,8 +6634,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_append(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_prepend(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - CameraWidget *arg2 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; + CameraWidget *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 = 0 ; @@ -6317,7 +6665,7 @@ SWIGINTERN PyObject *_wrap_gp_widget_prepend(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_count_children(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -6339,9 +6687,9 @@ SWIGINTERN PyObject *_wrap_gp_widget_count_children(PyObject *self, PyObject *ar SWIGINTERN PyObject *_wrap_gp_widget_get_child(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; int arg2 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -6399,9 +6747,9 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_child(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_child_by_label(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6462,9 +6810,9 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_child_by_label(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_widget_get_child_by_id(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; int arg2 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -6522,9 +6870,9 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_child_by_id(PyObject *self, PyObject *a SWIGINTERN PyObject *_wrap_gp_widget_get_child_by_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; - CameraWidget **arg3 = (CameraWidget **) 0 ; + CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; + CameraWidget **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6585,8 +6933,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_child_by_name(PyObject *self, PyObject SWIGINTERN PyObject *_wrap_gp_widget_get_root(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - CameraWidget **arg2 = (CameraWidget **) 0 ; + CameraWidget *arg1 = 0 ; + CameraWidget **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidget *temp2 ; @@ -6636,8 +6984,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_root(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_parent(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - CameraWidget **arg2 = (CameraWidget **) 0 ; + CameraWidget *arg1 = 0 ; + CameraWidget **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidget *temp2 ; @@ -6687,8 +7035,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_parent(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_widget_set_value(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - void *arg2 = (void *) 0 ; + CameraWidget *arg1 = 0 ; + void *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; VoidValue value2 ; @@ -6759,8 +7107,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_set_value(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_set_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; + CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6800,8 +7148,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_set_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_name(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char **arg2 = (char **) 0 ; + CameraWidget *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -6832,8 +7180,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_name(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_set_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; + CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -6873,8 +7221,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_set_info(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_info(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char **arg2 = (char **) 0 ; + CameraWidget *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -6905,8 +7253,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_info(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_id(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - int *arg2 = (int *) 0 ; + CameraWidget *arg1 = 0 ; + int *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int temp2 ; @@ -6937,8 +7285,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_id(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_type(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - CameraWidgetType *arg2 = (CameraWidgetType *) 0 ; + CameraWidget *arg1 = 0 ; + CameraWidgetType *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; CameraWidgetType temp2 ; @@ -6969,8 +7317,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_type(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_label(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char **arg2 = (char **) 0 ; + CameraWidget *arg1 = 0 ; + char **arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; char *temp2 ; @@ -7001,7 +7349,7 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_label(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_set_range(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; float arg2 ; float arg3 ; float arg4 ; @@ -7057,10 +7405,10 @@ SWIGINTERN PyObject *_wrap_gp_widget_set_range(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_get_range(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - float *arg2 = (float *) 0 ; - float *arg3 = (float *) 0 ; - float *arg4 = (float *) 0 ; + CameraWidget *arg1 = 0 ; + float *arg2 = 0 ; + float *arg3 = 0 ; + float *arg4 = 0 ; void *argp1 = 0 ; int res1 = 0 ; float temp2 ; @@ -7109,8 +7457,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_range(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_add_choice(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - char *arg2 = (char *) 0 ; + CameraWidget *arg1 = 0 ; + char *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -7150,7 +7498,7 @@ SWIGINTERN PyObject *_wrap_gp_widget_add_choice(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_widget_count_choices(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -7172,9 +7520,9 @@ SWIGINTERN PyObject *_wrap_gp_widget_count_choices(PyObject *self, PyObject *arg SWIGINTERN PyObject *_wrap_gp_widget_get_choice(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; int arg2 ; - char **arg3 = (char **) 0 ; + char **arg3 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int val2 ; @@ -7213,7 +7561,7 @@ SWIGINTERN PyObject *_wrap_gp_widget_get_choice(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_widget_changed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject * obj0 = 0 ; @@ -7235,7 +7583,7 @@ SWIGINTERN PyObject *_wrap_gp_widget_changed(PyObject *self, PyObject *args) { SWIGINTERN PyObject *_wrap_gp_widget_set_changed(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -7266,7 +7614,7 @@ SWIGINTERN PyObject *_wrap_gp_widget_set_changed(PyObject *self, PyObject *args) SWIGINTERN PyObject *_wrap_gp_widget_set_readonly(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; + CameraWidget *arg1 = 0 ; int arg2 ; void *argp1 = 0 ; int res1 = 0 ; @@ -7304,8 +7652,8 @@ SWIGINTERN PyObject *_wrap_gp_widget_set_readonly(PyObject *self, PyObject *args SWIGINTERN PyObject *_wrap_gp_widget_get_readonly(PyObject *self, PyObject *args) { PyObject *resultobj = 0; - CameraWidget *arg1 = (CameraWidget *) 0 ; - int *arg2 = (int *) 0 ; + CameraWidget *arg1 = 0 ; + int *arg2 = 0 ; void *argp1 = 0 ; int res1 = 0 ; int temp2 ; @@ -7930,22 +8278,7 @@ static PyMethodDef SwigMethods[] = { static SwigPyGetSet CameraWidget___dict___getset = { SwigPyObject_get___dict__, 0 }; SWIGINTERN PyGetSetDef SwigPyBuiltin___CameraWidget_getset[] = { - { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"\n" - "gp_widget_get_value\n" - "Retrieves the value of the CameraWidget. \n" - "\n" - "Parameters\n" - "----------\n" - "* `widget` : \n" - " a CameraWidget \n" - "* `value` : \n" - "\n" - "Returns\n" - "-------\n" - "a gphoto2 error code.\n" - "\n" - "See also gphoto2.CameraWidget.get_value\n" - "", &CameraWidget___dict___getset }, + { (char *)"__dict__", SwigPyBuiltin_GetterClosure, 0, (char *)"dictionary for instance variables", &CameraWidget___dict___getset }, { NULL, NULL, NULL, NULL, NULL } /* Sentinel */ }; @@ -7958,7 +8291,7 @@ SwigPyBuiltin___CameraWidget_richcompare(PyObject *self, PyObject *other, int op SWIG_Py_XINCREF(other); if (!result && !PyErr_Occurred()) { if (SwigPyObject_Check(self) && SwigPyObject_Check(other)) { - result = SwigPyObject_richcompare((SwigPyObject *)self, (SwigPyObject *)other, op); + result = SwigPyObject_richcompare(self, other, op); } else { result = Py_NotImplemented; SWIG_Py_INCREF(result); @@ -8485,7 +8818,7 @@ static PyHeapTypeObject SwigPyBuiltin___CameraWidget_type = { 0, /* tp_dict */ (descrgetfunc) 0, /* tp_descr_get */ (descrsetfunc) 0, /* tp_descr_set */ - offsetof(SwigPyObject, dict), /* tp_dictoffset */ + offsetof(SwigPyObject, swigdict), /* tp_dictoffset */ SwigPyBuiltin_BadInit, /* tp_init */ (allocfunc) 0, /* tp_alloc */ (newfunc) 0, /* tp_new */ @@ -8634,6 +8967,9 @@ static PyHeapTypeObject SwigPyBuiltin___CameraWidget_type = { #endif #if PY_VERSION_HEX >= 0x030b0000 (char *) 0, /* _ht_tpname */ +#if PY_VERSION_HEX >= 0x030e0000 + (void *) 0, /* ht_token */ +#endif { (PyObject *) 0, /* getitem */ #if PY_VERSION_HEX >= 0x030c0000 @@ -8657,7 +8993,6 @@ static PyTypeObject *SwigPyBuiltin___CameraWidget_type_create(PyTypeObject *type SWIG_Py_INCREF(pytype->tp_base); pytype->tp_bases = tuple_bases; if (PyType_Ready(pytype) < 0) { - PyErr_SetString(PyExc_TypeError, "Could not create type 'CameraWidget'."); return NULL; } return pytype; @@ -8665,83 +9000,21 @@ static PyTypeObject *SwigPyBuiltin___CameraWidget_type_create(PyTypeObject *type #else static PyTypeObject *SwigPyBuiltin___CameraWidget_type_create(PyTypeObject *type, PyTypeObject **bases, PyObject *dict) { - PyMemberDef members[] = { - { (char *)"__dictoffset__", Py_T_PYSSIZET, offsetof(SwigPyObject, dict), Py_READONLY, NULL }, - { NULL, 0, 0, 0, NULL } - }; PyType_Slot slots[] = { - { Py_tp_init, (void *)SwigPyBuiltin_BadInit }, - { Py_tp_dealloc, (void *)_wrap_delete_CameraWidget_destructor_closure }, - { Py_tp_alloc, (void *)(allocfunc) 0 }, - { Py_tp_free, (void *)(freefunc) 0 }, - { Py_tp_is_gc, (void *)(inquiry) 0 }, - { Py_tp_del, (void *)(destructor) 0 }, + { Py_tp_init, (void *)(initproc) SwigPyBuiltin_BadInit }, + { Py_tp_dealloc, (void *)(destructor) _wrap_delete_CameraWidget_destructor_closure }, { Py_tp_doc, (void *)"\n" "CameraWidget: \n" "\n" "The internals of the CameraWidget are only visible to gphoto2. You can\n" "only access them using the functions provided by gphoto2.\n" "" }, - { Py_tp_repr, (void *)(reprfunc) 0 }, - { Py_tp_str, (void *)(reprfunc) 0 }, - { Py_tp_traverse, (void *)(traverseproc) 0 }, - { Py_tp_clear, (void *)(inquiry) 0 }, - { Py_tp_richcompare, (void *)SwigPyBuiltin___CameraWidget_richcompare }, + { Py_tp_richcompare, (void *)(richcmpfunc) SwigPyBuiltin___CameraWidget_richcompare }, { Py_tp_methods, (void *)SwigPyBuiltin___CameraWidget_methods }, { Py_tp_getset, (void *)SwigPyBuiltin___CameraWidget_getset }, - { Py_tp_hash, (void *)SwigPyObject_hash }, - { Py_tp_call, (void *)(ternaryfunc) 0 }, - { Py_tp_getattro, (void *)(getattrofunc) 0 }, - { Py_tp_setattro, (void *)(setattrofunc) 0 }, - { Py_tp_descr_get, (void *)(descrgetfunc) 0 }, - { Py_tp_descr_set, (void *)(descrsetfunc) 0 }, - { Py_mp_length, (void *)(lenfunc) 0 }, - { Py_mp_subscript, (void *)(binaryfunc) 0 }, - { Py_mp_ass_subscript, (void *)(objobjargproc) 0 }, - { Py_tp_iter, (void *)(getiterfunc) 0 }, - { Py_tp_iternext, (void *)(iternextfunc) 0 }, - { Py_nb_add, (void *)(binaryfunc) 0 }, - { Py_nb_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_divmod, (void *)(binaryfunc) 0 }, - { Py_nb_power, (void *)(ternaryfunc) 0 }, - { Py_nb_negative, (void *)(unaryfunc) 0 }, - { Py_nb_positive, (void *)(unaryfunc) 0 }, - { Py_nb_absolute, (void *)(unaryfunc) 0 }, - { Py_nb_bool, (void *)(inquiry) 0 }, - { Py_nb_invert, (void *)(unaryfunc) 0 }, - { Py_nb_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_and, (void *)(binaryfunc) 0 }, - { Py_nb_xor, (void *)(binaryfunc) 0 }, - { Py_nb_or, (void *)(binaryfunc) 0 }, - { Py_nb_int, (void *)(unaryfunc) 0 }, - { Py_nb_float, (void *)(unaryfunc) 0 }, - { Py_nb_inplace_add, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_subtract, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_multiply, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_remainder, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_power, (void *)(ternaryfunc) 0 }, - { Py_nb_inplace_lshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_rshift, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_and, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_xor, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_or, (void *)(binaryfunc) 0 }, - { Py_nb_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_floor_divide, (void *)(binaryfunc) 0 }, - { Py_nb_inplace_true_divide, (void *)(binaryfunc) 0 }, - { Py_nb_index, (void *)(unaryfunc) 0 }, - { Py_sq_length, (void *)_wrap_CameraWidget___len___lenfunc_closure }, - { Py_sq_concat, (void *)(binaryfunc) 0 }, - { Py_sq_repeat, (void *)(ssizeargfunc) 0 }, - { Py_sq_item, (void *)_wrap_CameraWidget___getitem___ssizeargfunc_closure }, - { Py_sq_ass_item, (void *)(ssizeobjargproc) 0 }, - { Py_sq_contains, (void *)(objobjproc) 0 }, - { Py_sq_inplace_concat, (void *)(binaryfunc) 0 }, - { Py_sq_inplace_repeat, (void *)(ssizeargfunc) 0 }, - { Py_tp_members, members }, + { Py_tp_hash, (void *)(hashfunc) SwigPyObject_hash }, + { Py_sq_length, (void *)(lenfunc) _wrap_CameraWidget___len___lenfunc_closure }, + { Py_sq_item, (void *)(ssizeargfunc) _wrap_CameraWidget___getitem___ssizeargfunc_closure }, { 0, NULL } }; PyType_Spec spec = { @@ -8752,10 +9025,15 @@ static PyTypeObject *SwigPyBuiltin___CameraWidget_type_create(PyTypeObject *type slots }; PyObject *tuple_bases = SwigPyBuiltin_InitBases(bases); - PyTypeObject *pytype = (PyTypeObject*)PyType_FromSpecWithBases(&spec, tuple_bases); - PyDict_Merge(pytype->tp_dict, dict, 1); - SwigPyBuiltin_SetMetaType(pytype, type); - PyType_Modified(pytype); + PyTypeObject *pytype = (PyTypeObject *)PyType_FromSpecWithBases(&spec, tuple_bases); + if (pytype) { + if (PyDict_Merge(pytype->tp_dict, dict, 1) == 0) { + SwigPyBuiltin_SetMetaType(pytype, type); + PyType_Modified(pytype); + } else { + pytype = 0; + } + } Py_DECREF(dict); return pytype; } @@ -8822,7 +9100,7 @@ static PyTypeObject *builtin_bases[2]; /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic + * This problem is made tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. @@ -8837,15 +9115,20 @@ static PyTypeObject *builtin_bases[2]; * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a + * cast dependencies. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. + * a variable number of columns. + * + * We loop through the cast[] array associated with the type and mark casts + * which have not been defined in previously loaded modules by assigning + * cast pointer value to cast->next. We also hash cast->type->name string + * and store the value in the cast->value field. If we encounter swig_cast_info + * structure that represents a cast to self we move it to the beginning + * of the cast array. One trick we need to do is making sure the type pointer + * in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: @@ -8857,8 +9140,71 @@ static PyTypeObject *builtin_bases[2]; * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will + * swig_cast_info to the list (because the cast->type) pointer will * be correct. + * + * Once the cast array has been set up AND it does have new casts that need + * to be added we sort non-self cast entries to move filtered out entries + * to the end of the array and to arrange the rest in the increasing order + * of their type pointer values. We store the index of the last added entry + * in the cast->value field of the entry[0] (overwriting the name hash). Then + * we sort fields of the remaining entries to arrange hash values + * in the increasing order. This way cast->next->type->name field matches + * the cast->value hash. + * + * Example: + * Array of casts for type stored at 0x5000, cast to type stored at 0x3000 + * has already been loaded + * + * After sweep-and-hash: After sort-by-type: After sort-by-hash: + * ________________ ________________ ________________ + * | | | | | | + * Entry | type = 0x5000 | | type = 0x5000 | | type = 0x5000 | + * 0 | | | | | | + * | next = Entry0 | | next = Entry0 | | next = Entry0 | + * | value = 1212 | | value = 3 | | value = 3 | + * | | | | | | + * |================| |================| |================| + * | | | | | | + * Entry | type = 0x2000 | | type = 0x1000 | | type = 0x1000 | + * 1 | | | | | | + * | next = Entry1 | | next = Entry1 | | next = Entry3 | + * | value = 3434 | | value = 4545 | | value = 2323 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x3000 | | type = 0x2000 | | type = 0x2000 | + * 2 | | | | | | + * | next = 0 | | next = Entry2 | | next = Entry2 | + * | value = 0 | | value = 3434 | | value = 3434 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x1000 | | type = 0x4000 | | type = 0x4000 | + * 3 | | | | | | + * | next = Entry3 | | next = Entry3 | | next = Entry1 | + * | value = 4545 | | value = 2323 | | value = 4545 | + * |________________| |________________| |________________| + * | | | | | | + * Entry | type = 0x4000 | | type = 0x3000 | | type = 0x3000 | + * 4 | | | | | | + * | next = Entry4 | | next = 0 | | next = 0 | + * | value = 2323 | | value = 0 | | value = 0 | + * |________________| |________________| |________________| + * + * Once the cast array has been initialized, we use cast[0]->next field to link + * it into the list of cast arrays for the type. + * ____ ____ ____ + * type->cast->|next|->|next|->|next|->0 + * |----| |----| |----| + * |----| |----| |----| + * |----| |----| |----| + * + * Subsequent cast resolution works as follows: + * + * 1. Check whether the type matches the first entry in the current cast array. + * 2. If not, then do a binary search over the (0:cast->value] interval using + * either type address or the hash value of the type name. + * 3. If not found, then move over to the next cast array (cast[0]->next). + * * ----------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -8876,6 +9222,46 @@ extern "C" { #define SWIG_INIT_CLIENT_DATA_TYPE void * #endif +/* + * Sort function that puts cast entries with nonzero 'next' at the front + * of the array while ordering them by addresses of their 'type' structs. + */ +SWIGINTERN int SWIG_CastCmpStruct(const void *pa, const void *pb) { + swig_cast_info *pca = (swig_cast_info *)pa; + swig_cast_info *pcb = (swig_cast_info *)pb; + if (pca->type < pcb->type) + return (pca->next || pcb->next == 0) ? -1 : 1; + if (pca->type > pcb->type) + return (pcb->next || pca->next == 0) ? 1 : -1; + return 0; +} + +/* + * Shell-sort 'next' and 'value' field pairs to order them by 'value'. + */ +SWIGINTERN void SWIG_CastHashSort(swig_cast_info *cast, int size) { + const int hmax = size/9; + int h, i; + for(h = 1; h <= hmax; h = 3*h+1); + for(; h > 0; h /= 3) + { + for(i = h; i < size; ++i) + { + swig_cast_info *p = cast[i].next; + unsigned int hash = cast[i].value; + int j = i; + while(j >= h && hash < cast[j-h].value) + { + cast[j].next = cast[j-h].next; + cast[j].value = cast[j-h].value; + j -= h; + } + cast[j].next = p; + cast[j].value = hash; + } + } +} + SWIGRUNTIME void SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; @@ -8927,8 +9313,9 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; + swig_type_info *target_type; + swig_cast_info *cast, *first; + int num_mapped = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); @@ -8954,48 +9341,101 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { } /* Insert casting types */ - cast = swig_module.cast_initial[i]; + cast = first = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ - ret = 0; + target_type = 0; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); #endif if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + target_type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); + if (target_type) { + /* Target type already defined in another module */ #ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); + printf("SWIG_InitializeModule: found cast %s\n", target_type->name); #endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { + if (type == swig_module.type_initial[i]) { #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); + printf("SWIG_InitializeModule: skip old type %s\n", target_type->name); #endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); + cast->type = target_type; + target_type = 0; + } else { + /* Check if this cast is already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(target_type->name, type); #ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", target_type->name); #endif - if (!ocast) ret = 0; + if (!ocast) target_type = 0; + } } } - if (!ret) { + if (!target_type) { #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); #endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; + /* Set inclusion mark for sorting */ + cast->next = cast; + num_mapped++; + + if (type == cast->type) { +#ifdef SWIGRUNTIME_DEBUG + printf("%s : self cast at pos [%li]\n", type->name, cast - first); +#endif + if (cast - first) { + /* Move cast to itself to the first entry in the array */ + + swig_cast_info tmp = *cast; + *cast = *first; + *first = tmp; + } + first++; + + } else { + cast->value = SWIG_Hash(cast->type->name, (unsigned int)strlen(cast->type->name)); } - type->cast = cast; } cast++; } + + if (num_mapped) { + if (cast - first) { + swig_cast_info *tmp; + + /* Sort casts by type address for binary search in SWIG_TypeCheckStruct */ + qsort(first, cast - first, sizeof(swig_cast_info), SWIG_CastCmpStruct); + + /* Remap back links for added entries */ + cast = swig_module.cast_initial[i] + num_mapped; + for (tmp = first; tmp < cast; tmp++) { + tmp->next = tmp; + } + } + + /* Set the value field of the first entry to the index of the last added entry */ + cast = swig_module.cast_initial[i]; + cast->value = num_mapped - 1; + + num_mapped -= (int)(first - cast); + if (num_mapped > 1) { + /* Sort <'next','value'> pairs by 'value' for binary search in SWIG_TypeCheck */ + + SWIG_CastHashSort(first, num_mapped); + } + + first = type->cast; + if (first) { + /* Link the current set into the list of cast arrays */ + cast->next = first->next; + first->next = cast; + } else { + cast->next = 0; + type->cast = cast; + } + } + /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } @@ -9026,7 +9466,6 @@ SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { SWIGRUNTIME void SWIG_PropagateClientData(void) { size_t i; - swig_cast_info *equiv; static int init_run = 0; if (init_run) return; @@ -9034,13 +9473,16 @@ SWIG_PropagateClientData(void) { for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + swig_cast_info *head, *cast; + head = swig_module.types[i]->cast; + while (head) { + for (cast = head; (cast - head) <= head->value; cast++) { + if (!cast->converter) { + if (cast->type && !cast->type->clientdata) + SWIG_TypeClientData(cast->type, swig_module.types[i]->clientdata); + } } - equiv = equiv->next; + head = head->next; } } } @@ -9144,6 +9586,8 @@ extern "C" { * Partial Init method * -----------------------------------------------------------------------------*/ +SWIGINTERN int SWIG_mod_exec(PyObject *module); + #ifdef __cplusplus extern "C" #endif @@ -9155,21 +9599,46 @@ PyObject* void #endif SWIG_init(void) { - PyObject *m, *d, *md, *globals; - #if PY_VERSION_HEX >= 0x03000000 + static PyModuleDef_Slot SwigSlots[] = { + { + Py_mod_exec, (void *)SWIG_mod_exec + }, +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + { + Py_mod_gil, Py_MOD_GIL_NOT_USED + }, +#endif +#endif + { + 0, NULL + } + }; + static struct PyModuleDef SWIG_module = { PyModuleDef_HEAD_INIT, SWIG_name, NULL, - -1, + 0, SwigMethods, - NULL, + SwigSlots, NULL, NULL, NULL }; + + return PyModuleDef_Init(&SWIG_module); +#else + PyObject *m = Py_InitModule(SWIG_name, SwigMethods); + if (m && SWIG_mod_exec(m) != 0) { + Py_DECREF(m); + } #endif +} + +SWIGINTERN int SWIG_mod_exec(PyObject *m) { + PyObject *d, *md, *globals; #if defined(SWIGPYTHON_BUILTIN) static SwigPyClientData SwigPyObject_clientdata = { @@ -9207,27 +9676,31 @@ SWIG_init(void) { (void)self; /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); + metatype = SwigPyObjectType_Type(); assert(metatype); + + SwigPyStaticVar_Type(); #endif (void)globals; /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ + SWIG_runtime_data_module(); SWIG_This(); SWIG_Python_TypeCache(); - SwigPyPacked_type(); + SwigPyPacked_Type(); + SwigVarLink_Type(); #ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); + SwigPyObject_Type(); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); +#ifdef SWIGPYTHON_NOGIL +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED); +#endif #endif md = d = PyModule_GetDict(m); @@ -9246,19 +9719,15 @@ SWIG_init(void) { SwigPyObject_clientdata.pytype = swigpyobject; } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif + return -1; } /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + this_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &this_getset_def); (void)this_descr; /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + thisown_descr = PyDescr_NewGetSet(SwigPyObject_Type(), &thisown_getset_def); (void)thisown_descr; public_interface = PyList_New(0); @@ -9283,7 +9752,9 @@ SWIG_init(void) { SWIG_Py_DECREF(module); } if (PyExc_GPhoto2Error == NULL) -#if PY_VERSION_HEX >= 0x03000000 +#if SWIG_VERSION >= 0x040400 + return -1; +#elif PY_VERSION_HEX >= 0x03000000 return NULL; #else return; @@ -9299,15 +9770,14 @@ SWIG_init(void) { PyDict_SetItemString(d, "thisown", thisown_descr); builtin_pytype = SwigPyBuiltin___CameraWidget_type_create(metatype, builtin_bases, d); if(!builtin_pytype) { -#if PY_VERSION_HEX >= 0x03000000 - return NULL; -#else - return; -#endif + return -1; } SwigPyBuiltin___CameraWidget_clientdata.pytype = builtin_pytype; SWIG_Py_INCREF((PyObject *)builtin_pytype); - PyModule_AddObject(m, "CameraWidget", (PyObject *)builtin_pytype); + if (PyModule_AddObject(m, "CameraWidget", (PyObject *)builtin_pytype) != 0) { + SWIG_Py_DECREF((PyObject *)builtin_pytype); + return -1; + } SwigPyBuiltin_AddPublicSymbol(public_interface, "CameraWidget"); d = md; SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_WIDGET_WINDOW",SWIG_From_int((int)(GP_WIDGET_WINDOW))); @@ -9319,10 +9789,6 @@ SWIG_init(void) { SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_WIDGET_MENU",SWIG_From_int((int)(GP_WIDGET_MENU))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_WIDGET_BUTTON",SWIG_From_int((int)(GP_WIDGET_BUTTON))); SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "GP_WIDGET_DATE",SWIG_From_int((int)(GP_WIDGET_DATE))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif + return 0; } diff --git a/tests/test_port_log.py b/tests/test_port_log.py index 748fdc7..e588347 100644 --- a/tests/test_port_log.py +++ b/tests/test_port_log.py @@ -1,6 +1,6 @@ # python-gphoto2 - Python interface to libgphoto2 # http://github.com/jim-easterbrook/python-gphoto2 -# Copyright (C) 2023 Jim Easterbrook jim@jim-easterbrook.me.uk +# Copyright (C) 2023-25 Jim Easterbrook jim@jim-easterbrook.me.uk # # This file is part of python-gphoto2. # @@ -48,12 +48,14 @@ def test_c_style(self): gp.gp_log(gp.GP_LOG_DEBUG, 'wrong', 'wrong') def test_use_python_logging(self): - self.assertEqual(sys.getrefcount(_gphoto2_logger_cb), 3) + if sys.version_info < (3, 14): + self.assertEqual(sys.getrefcount(_gphoto2_logger_cb), 3) # test default mapping # GP_LOG_DATA maps to DEBUG - 5 which self.assertLogs doesn't handle OK, callbacks = gp.use_python_logging() self.assertGreaterEqual(OK, gp.GP_OK) - self.assertEqual(sys.getrefcount(_gphoto2_logger_cb), 4) + if sys.version_info < (3, 14): + self.assertEqual(sys.getrefcount(_gphoto2_logger_cb), 4) with self.assertLogs('gphoto2', logging.DEBUG): gp.gp_log(gp.GP_LOG_DEBUG, 'debug', 'debug_message') with self.assertLogs('gphoto2', logging.INFO): @@ -61,7 +63,8 @@ def test_use_python_logging(self): with self.assertLogs('gphoto2', logging.WARNING): gp.gp_log(gp.GP_LOG_ERROR, 'error', 'error_message') del callbacks - self.assertEqual(sys.getrefcount(_gphoto2_logger_cb), 3) + if sys.version_info < (3, 14): + self.assertEqual(sys.getrefcount(_gphoto2_logger_cb), 3) # test custom mapping OK, callbacks = gp.use_python_logging(mapping={ gp.GP_LOG_ERROR : logging.CRITICAL,