From f1234aae4207efa8643acfef39c82856e7ea114f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 9 Apr 2011 23:48:19 +0000 Subject: [PATCH] Cosmetics - Fix bracket matching git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12622 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/builtin.swg | 8 ++++++++ Lib/python/pyapi.swg | 6 ------ Lib/python/pyrun.swg | 28 ++++++++++++++-------------- Lib/tcl/tclrun.swg | 6 ------ 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg index da4d8fdf8..8852832d1 100644 --- a/Lib/python/builtin.swg +++ b/Lib/python/builtin.swg @@ -188,6 +188,10 @@ wrapper##_closure(PyObject *a) { \ return result; \ } +#ifdef __cplusplus +extern "C" { +#endif + 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); @@ -471,3 +475,7 @@ SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) type->ob_type = metatype; #endif } + +#ifdef __cplusplus +} +#endif diff --git a/Lib/python/pyapi.swg b/Lib/python/pyapi.swg index 4e4479e8c..2da05f9e9 100644 --- a/Lib/python/pyapi.swg +++ b/Lib/python/pyapi.swg @@ -4,9 +4,6 @@ #ifdef __cplusplus extern "C" { -#if 0 -} /* cc-mode */ -#endif #endif /* ----------------------------------------------------------------------------- @@ -45,9 +42,6 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), #endif #ifdef __cplusplus -#if 0 -{ /* cc-mode */ -#endif } #endif diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 33229daee..773862695 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -231,9 +231,6 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi #ifdef __cplusplus extern "C" { -#if 0 -} /* cc-mode */ -#endif #endif /* How to access Py_None */ @@ -1528,11 +1525,13 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o) SWIGRUNTIME void #ifdef SWIGPY_USE_CAPSULE SWIG_Python_DestroyModule(PyObject *obj) -{ - swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); #else SWIG_Python_DestroyModule(void *vptr) +#endif { +#ifdef SWIGPY_USE_CAPSULE + swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); +#else swig_module_info *swig_module = (swig_module_info *) vptr; #endif swig_type_info **types = swig_module->types; @@ -1561,14 +1560,17 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } #else PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); -#endif } else { Py_XDECREF(pointer); } +#endif } /* The python cached type query */ @@ -1730,14 +1732,15 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); if (!name) return -1; - } else if (!PyUnicode_Check(name)) { + } else if (!PyUnicode_Check(name)) #else - if (!PyString_Check(name)) { + if (!PyString_Check(name)) #endif - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); - return -1; + { + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); + return -1; } else { - Py_INCREF(name); + Py_INCREF(name); } if (!tp->tp_dict) { @@ -1770,8 +1773,5 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { #ifdef __cplusplus -#if 0 -{ /* cc-mode */ -#endif } #endif diff --git a/Lib/tcl/tclrun.swg b/Lib/tcl/tclrun.swg index dd6458e90..240560b80 100644 --- a/Lib/tcl/tclrun.swg +++ b/Lib/tcl/tclrun.swg @@ -71,9 +71,6 @@ #ifdef __cplusplus extern "C" { -#if 0 -} /* cc-mode */ -#endif #endif /* Object support */ @@ -683,8 +680,5 @@ SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char } #ifdef __cplusplus -#if 0 -{ /* cc-mode */ -#endif } #endif