From ff6009d09aa0af0ac263d820b2beb9b47d8813ea Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 21 May 2013 15:02:28 +0000 Subject: [PATCH] gdb/ Workaround Python 2.6. * python/py-utils.c (gdb_pymodule_addobject): Wrap Py_DECREF into a block. --- gdb/ChangeLog | 6 ++++++ gdb/python/py-utils.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 79bc1b3fa26..2b6023da42c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-05-21 Jan Kratochvil + + Workaround Python 2.6. + * python/py-utils.c (gdb_pymodule_addobject): Wrap Py_DECREF into + a block. + 2013-05-21 Jan Kratochvil Code cleanup: constification. diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c index d87eb8caf65..e78dee0b9f7 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; } -- 2.30.2