| 1879 | static PyObject* Swig_Capsule_global = NULL; |
| 1880 | |
| 1881 | SWIGRUNTIME void |
| 1882 | SwigPyObject_dealloc(PyObject *v) |
| 1883 | { |
| 1884 | SwigPyObject *sobj = (SwigPyObject *) v; |
| 1885 | PyObject *next = sobj->next; |
| 1886 | if (sobj->own == SWIG_POINTER_OWN) { |
| 1887 | swig_type_info *ty = sobj->ty; |
| 1888 | SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; |
| 1889 | PyObject *destroy = data ? data->destroy : 0; |
| 1890 | if (destroy) { |
| 1891 | /* destroy is always a VARARGS method */ |
| 1892 | PyObject *res; |
| 1893 | |
| 1894 | /* PyObject_CallFunction() has the potential to silently drop |
| 1895 | the active exception. In cases of unnamed temporary |
| 1896 | variable or where we just finished iterating over a generator |
| 1897 | StopIteration will be active right now, and this needs to |
| 1898 | remain true upon return from SwigPyObject_dealloc. So save |
| 1899 | and restore. */ |
| 1900 | |
| 1901 | PyObject *type = NULL, *value = NULL, *traceback = NULL; |
| 1902 | PyErr_Fetch(&type, &value, &traceback); |
| 1903 | |
| 1904 | if (data->delargs) { |
| 1905 | /* we need to create a temporary object to carry the destroy operation */ |
| 1906 | PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); |
| 1907 | if (tmp) { |
| 1908 | res = SWIG_Python_CallFunctor(destroy, tmp); |
| 1909 | } else { |
| 1910 | res = 0; |
| 1911 | } |
| 1912 | Py_XDECREF(tmp); |
| 1913 | } else { |
| 1914 | PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); |
| 1915 | PyObject *mself = PyCFunction_GET_SELF(destroy); |
| 1916 | res = ((*meth)(mself, v)); |
| 1917 | } |
| 1918 | if (!res) |
| 1919 | PyErr_WriteUnraisable(destroy); |
| 1920 | |
| 1921 | PyErr_Restore(type, value, traceback); |
| 1922 | |
| 1923 | Py_XDECREF(res); |
| 1924 | } |
| 1925 | #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) |
| 1926 | else { |
| 1927 | const char *name = SWIG_TypePrettyName(ty); |
| 1928 | printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); |
| 1929 | } |
| 1930 | #endif |
| 1931 | Py_XDECREF(Swig_Capsule_global); |
| 1932 | } |
| 1933 | Py_XDECREF(next); |
| 1934 | #ifdef SWIGPYTHON_BUILTIN |
| 1935 | Py_XDECREF(sobj->dict); |
| 1936 | #endif |
| 1937 | PyObject_DEL(v); |
| 1938 | } |
nothing calls this directly
no test coverage detected