1 diff -up swig-2.0.0/Lib/python/pyrun.swg.rh623854 swig-2.0.0/Lib/python/pyrun.swg
2 --- swig-2.0.0/Lib/python/pyrun.swg.rh623854 2010-02-28 00:26:02.000000000 +0100
3 +++ swig-2.0.0/Lib/python/pyrun.swg 2010-08-17 16:32:16.581604656 +0200
5 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
6 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
7 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
8 -#define SWIG_fail goto fail
9 +#define SWIG_fail goto fail
12 + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of
15 +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
16 + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0))
18 +#define TYPE_POINTER_NAME \
19 + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
22 /* Runtime API implementation */
24 @@ -1356,8 +1366,12 @@ SWIG_Python_GetModule(void) {
25 #ifdef SWIG_LINK_RUNTIME
26 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
29 + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0);
31 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
32 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
34 if (PyErr_Occurred()) {
36 type_pointer = (void *)0;
37 @@ -1402,9 +1416,14 @@ PyModule_AddObject(PyObject *m, char *na
39 SWIG_Python_DestroyModule(void *vptr)
43 + swig_module_info *swig_module =
44 + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME);
46 swig_module_info *swig_module = (swig_module_info *) vptr;
48 swig_type_info **types = swig_module->types;
50 for (i =0; i < swig_module->size; ++i) {
51 swig_type_info *ty = types[i];
53 @@ -1426,9 +1445,18 @@ SWIG_Python_SetModule(swig_module_info *
54 PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
55 swig_empty_runtime_method_table);
58 + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME,
59 + (PyCapsule_Destructor)SWIG_Python_DestroyModule);
61 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
63 if (pointer && module) {
65 + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
67 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
72 @@ -1449,12 +1477,20 @@ SWIG_Python_TypeQuery(const char *type)
73 PyObject *obj = PyDict_GetItem(cache, key);
74 swig_type_info *descriptor;
77 + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type);
79 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
82 swig_module_info *swig_module = SWIG_Python_GetModule();
83 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
86 + obj = PyCapsule_New(descriptor, type, NULL);
88 obj = PyCObject_FromVoidPtr(descriptor, NULL);
90 PyDict_SetItem(cache, key, obj);