]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - swig/patches/swig200-rh623854.patch
pdns: Update to version 3.4.7
[people/amarx/ipfire-3.x.git] / swig / patches / swig200-rh623854.patch
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
4 @@ -45,8 +45,18 @@
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
10
11 +/*
12 + * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of
13 + * CObjects API.
14 + */
15 +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
16 + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0))
17 +#define USE_CAPSULES
18 +#define TYPE_POINTER_NAME \
19 + ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
20 +#endif
21
22 /* Runtime API implementation */
23
24 @@ -1356,8 +1366,12 @@ SWIG_Python_GetModule(void) {
25 #ifdef SWIG_LINK_RUNTIME
26 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
27 #else
28 +#ifdef USE_CAPSULES
29 + type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0);
30 +#else
31 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
32 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
33 +#endif
34 if (PyErr_Occurred()) {
35 PyErr_Clear();
36 type_pointer = (void *)0;
37 @@ -1402,9 +1416,14 @@ PyModule_AddObject(PyObject *m, char *na
38 SWIGRUNTIME void
39 SWIG_Python_DestroyModule(void *vptr)
40 {
41 + size_t i;
42 +#ifdef USE_CAPSULES
43 + swig_module_info *swig_module =
44 + (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME);
45 +#else
46 swig_module_info *swig_module = (swig_module_info *) vptr;
47 +#endif
48 swig_type_info **types = swig_module->types;
49 - size_t i;
50 for (i =0; i < swig_module->size; ++i) {
51 swig_type_info *ty = types[i];
52 if (ty->owndata) {
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);
56 #endif
57 +#ifdef USE_CAPSULES
58 + PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME,
59 + (PyCapsule_Destructor)SWIG_Python_DestroyModule);
60 +#else
61 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
62 +#endif
63 if (pointer && module) {
64 +#ifdef USE_CAPSULES
65 + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
66 +#else
67 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
68 +#endif
69 } else {
70 Py_XDECREF(pointer);
71 }
72 @@ -1449,12 +1477,20 @@ SWIG_Python_TypeQuery(const char *type)
73 PyObject *obj = PyDict_GetItem(cache, key);
74 swig_type_info *descriptor;
75 if (obj) {
76 +#ifdef USE_CAPSULES
77 + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type);
78 +#else
79 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
80 +#endif
81 } else {
82 swig_module_info *swig_module = SWIG_Python_GetModule();
83 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
84 if (descriptor) {
85 +#ifdef USE_CAPSULES
86 + obj = PyCapsule_New(descriptor, type, NULL);
87 +#else
88 obj = PyCObject_FromVoidPtr(descriptor, NULL);
89 +#endif
90 PyDict_SetItem(cache, key, obj);
91 Py_DECREF(obj);
92 }