aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/python/py-utils.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 79bc1b3..2b6023d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2013-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Workaround Python 2.6.
+ * python/py-utils.c (gdb_pymodule_addobject): Wrap Py_DECREF into
+ a block.
+
+2013-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Code cleanup: constification.
* solib.c (solib_ops): Make return type and ops variable type const.
(set_solib_ops): Make the new_ops parameter and ops variable const.
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index d87eb8c..e78dee0 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -443,6 +443,9 @@ gdb_pymodule_addobject (PyObject *module, const char *name, PyObject *object)
Py_INCREF (object);
result = PyModule_AddObject (module, name, object);
if (result < 0)
- Py_DECREF (object);
+ {
+ /* Python 2.6 did not wrap Py_DECREF in do { } while (0);. */
+ Py_DECREF (object);
+ }
return result;
}