Fix to make ISOC89 compliant: -Werror=declaration-after-statement
diff --git a/Lib/python/pyerrors.swg b/Lib/python/pyerrors.swg
index 85c7d86..f21d28b 100644
--- a/Lib/python/pyerrors.swg
+++ b/Lib/python/pyerrors.swg
@@ -87,12 +87,13 @@
{
if (SWIG_Python_TypeErrorOccurred(NULL)) {
/* Use existing TypeError to preserve stacktrace and enhance with given message */
+ PyObject *newvalue;
PyObject *type = NULL, *value = NULL, *traceback = NULL;
PyErr_Fetch(&type, &value, &traceback);
#if PY_VERSION_HEX >= 0x03000000
- PyObject *newvalue = PyUnicode_FromFormat("%S\nAdditional Information:\n%s", value, message);
+ newvalue = PyUnicode_FromFormat("%S\nAdditional Information:\n%s", value, message);
#else
- PyObject *newvalue = PyString_FromFormat("%s\nAdditional Information:\n%s", PyString_AsString(value), message);
+ newvalue = PyString_FromFormat("%s\nAdditional Information:\n%s", PyString_AsString(value), message);
#endif
Py_XDECREF(value);
PyErr_Restore(type, newvalue, traceback);
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index dfdee8d..40bc06b 100755
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -2586,6 +2586,10 @@
dispatch = Swig_overload_dispatch_cast(n, dispatch_code, &maxargs);
} else {
String *fastdispatch_code = NewStringf("PyObject *retobj = %s\nif (!SWIG_Python_TypeErrorOccurred(retobj)) return retobj;\nSWIG_fail;", dispatch_call);
+ if (!CPlusPlus) {
+ Insert(fastdispatch_code, 0, "{\n");
+ Append(fastdispatch_code, "\n}");
+ }
dispatch = Swig_overload_dispatch(n, dispatch_code, &maxargs, fastdispatch_code);
Delete(fastdispatch_code);
}