11/* ----------------------------------------------------------------------------
22 * This file was automatically generated by SWIG (http://www.swig.org).
3- * Version 1.3.40
3+ * Version 2.0.1+capsulehack
44 *
55 * This file is not intended to be easily readable and contains a number of
66 * coding conventions designed to improve portability and efficiency. Do not make
@@ -201,7 +201,7 @@ template <typename T> T SwigValueInit() {
201201/*
202202 Flags/methods for returning states.
203203
204- The SWIG conversion methods, as ConvertPtr, return and integer
204+ The SWIG conversion methods, as ConvertPtr, return an integer
205205 that tells if the conversion was successful or not. And if not,
206206 an error code can be returned (see swigerrors.swg for the codes).
207207
@@ -1088,9 +1088,6 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func)
10881088
10891089
10901090/* -----------------------------------------------------------------------------
1091- * See the LICENSE file for information on copyright, usage and redistribution
1092- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1093- *
10941091 * pyrun.swg
10951092 *
10961093 * This file contains the runtime support for Python modules
@@ -1137,8 +1134,18 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func)
11371134#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
11381135#define SWIG_ErrorType (code ) SWIG_Python_ErrorType(code)
11391136#define SWIG_Error (code, msg ) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1140- #define SWIG_fail goto fail
1137+ #define SWIG_fail goto fail
11411138
1139+ /*
1140+ * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of
1141+ * CObjects API.
1142+ */
1143+ #if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
1144+ (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0 ))
1145+ #define USE_CAPSULES
1146+ #define TYPE_POINTER_NAME \
1147+ ((char *)" swig_runtime_data" SWIG_RUNTIME_VERSION " .type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
1148+ #endif
11421149
11431150/* Runtime API implementation */
11441151
@@ -2071,10 +2078,13 @@ _SWIG_This(void)
20712078 return SWIG_Python_str_FromChar (" this" );
20722079}
20732080
2081+ static PyObject *swig_this = NULL ;
2082+
20742083SWIGRUNTIME PyObject *
20752084SWIG_This (void )
20762085{
2077- static PyObject *SWIG_STATIC_POINTER (swig_this) = _SWIG_This ();
2086+ if (swig_this == NULL )
2087+ swig_this = _SWIG_This ();
20782088 return swig_this;
20792089}
20802090
@@ -2178,7 +2188,7 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
21782188 int newmemory = 0 ;
21792189 *ptr = SWIG_TypeCast (tc,vptr,&newmemory);
21802190 if (newmemory == SWIG_CAST_NEW_MEMORY) {
2181- assert (own);
2191+ assert (own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
21822192 if (own)
21832193 *own = *own | SWIG_CAST_NEW_MEMORY;
21842194 }
@@ -2447,9 +2457,13 @@ SWIG_Python_GetModule(void) {
24472457 if (!type_pointer) {
24482458#ifdef SWIG_LINK_RUNTIME
24492459 type_pointer = SWIG_ReturnGlobalTypeList ((void *)0 );
2460+ #else
2461+ #ifdef USE_CAPSULES
2462+ type_pointer = PyCapsule_Import (TYPE_POINTER_NAME, 0 );
24502463#else
24512464 type_pointer = PyCObject_Import ((char *)" swig_runtime_data" SWIG_RUNTIME_VERSION,
24522465 (char *)" type_pointer" SWIG_TYPE_TABLE_NAME);
2466+ #endif
24532467 if (PyErr_Occurred ()) {
24542468 PyErr_Clear ();
24552469 type_pointer = (void *)0 ;
@@ -2494,9 +2508,14 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
24942508SWIGRUNTIME void
24952509SWIG_Python_DestroyModule (void *vptr)
24962510{
2511+ size_t i;
2512+ #ifdef USE_CAPSULES
2513+ swig_module_info *swig_module =
2514+ (swig_module_info *) PyCapsule_GetPointer ((PyObject *)vptr, TYPE_POINTER_NAME);
2515+ #else
24972516 swig_module_info *swig_module = (swig_module_info *) vptr;
2517+ #endif
24982518 swig_type_info **types = swig_module->types ;
2499- size_t i;
25002519 for (i =0 ; i < swig_module->size ; ++i) {
25012520 swig_type_info *ty = types[i];
25022521 if (ty->owndata ) {
@@ -2505,6 +2524,7 @@ SWIG_Python_DestroyModule(void *vptr)
25052524 }
25062525 }
25072526 Py_DECREF (SWIG_This ());
2527+ swig_this = NULL ;
25082528}
25092529
25102530SWIGRUNTIME void
@@ -2518,9 +2538,18 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
25182538 PyObject *module = Py_InitModule ((char *)" swig_runtime_data" SWIG_RUNTIME_VERSION,
25192539 swig_empty_runtime_method_table);
25202540#endif
2541+ #ifdef USE_CAPSULES
2542+ PyObject *pointer = PyCapsule_New ((void *)swig_module, TYPE_POINTER_NAME,
2543+ (PyCapsule_Destructor)SWIG_Python_DestroyModule);
2544+ #else
25212545 PyObject *pointer = PyCObject_FromVoidPtr ((void *) swig_module, SWIG_Python_DestroyModule);
2546+ #endif
25222547 if (pointer && module ) {
2548+ #ifdef USE_CAPSULES
2549+ PyModule_AddObject (module , (char *)" type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2550+ #else
25232551 PyModule_AddObject (module , (char *)" type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2552+ #endif
25242553 } else {
25252554 Py_XDECREF (pointer);
25262555 }
@@ -2541,12 +2570,20 @@ SWIG_Python_TypeQuery(const char *type)
25412570 PyObject *obj = PyDict_GetItem (cache, key);
25422571 swig_type_info *descriptor;
25432572 if (obj) {
2573+ #ifdef USE_CAPSULES
2574+ descriptor = (swig_type_info *) PyCapsule_GetPointer (obj, type);
2575+ #else
25442576 descriptor = (swig_type_info *) PyCObject_AsVoidPtr (obj);
2577+ #endif
25452578 } else {
25462579 swig_module_info *swig_module = SWIG_Python_GetModule ();
25472580 descriptor = SWIG_TypeQueryModule (swig_module, swig_module, type);
25482581 if (descriptor) {
2582+ #ifdef USE_CAPSULES
2583+ obj = PyCapsule_New (descriptor, type, NULL );
2584+ #else
25492585 obj = PyCObject_FromVoidPtr (descriptor, NULL );
2586+ #endif
25502587 PyDict_SetItem (cache, key, obj);
25512588 Py_DECREF (obj);
25522589 }
@@ -2708,7 +2745,7 @@ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
27082745#endif
27092746#define SWIG_name " _csgraph"
27102747
2711- #define SWIGVERSION 0x010340
2748+ #define SWIGVERSION 0x020001
27122749#define SWIG_VERSION SWIGVERSION
27132750
27142751
@@ -2781,6 +2818,7 @@ namespace swig {
27812818}
27822819
27832820
2821+ #include " py3k.h"
27842822#define SWIG_FILE_WITH_INIT
27852823#include " Python.h"
27862824#include " numpy/arrayobject.h"
@@ -3919,15 +3957,15 @@ extern "C" {
39193957 }
39203958 }
39213959 if (ci) {
3922- size_t shift = (ci->ptype ) - types ;
3923- swig_type_info *ty = types_initial[shift];
3924- size_t ldoc = (c - methods[i]. ml_doc ) ;
3925- size_t lptr = strlen (ty-> name )+ 2 * sizeof ( void *)+ 2 ;
3926- char *ndoc = ( char *) malloc ( ldoc + lptr + 10 );
3927- if (ndoc) {
3928- char *buff = ndoc ;
3929- void *ptr = (ci-> type == SWIG_PY_POINTER) ? ci-> pvalue : 0 ;
3930- if (ptr) {
3960+ void *ptr = (ci->type == SWIG_PY_POINTER) ? ci-> pvalue : 0 ;
3961+ if (ptr) {
3962+ size_t shift = (ci-> ptype ) - types ;
3963+ swig_type_info *ty = types_initial[shift] ;
3964+ size_t ldoc = (c - methods[i]. ml_doc );
3965+ size_t lptr = strlen (ty-> name )+ 2 * sizeof ( void *)+ 2 ;
3966+ char *ndoc = ( char *) malloc (ldoc + lptr + 10 ) ;
3967+ if (ndoc) {
3968+ char *buff = ndoc;
39313969 strncpy (buff, methods[i].ml_doc , ldoc);
39323970 buff += ldoc;
39333971 strncpy (buff, " swig_ptr: " , 10 );
0 commit comments