Re: [patch] Compilation regression with python-2.6 [Re: [PATCH 24/28] introduce gdb_pymodule_addobject]

Tom Tromey
2013-05-21T16:36:49Z

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I notice that py_decref could actually be using Py_XDECREF instead
Pedro> of doing the explicit 'if (py)' check.

Pedro> - /* Note that we need the extra braces in this 'if' to avoid a
Pedro> - warning from gcc. */
Pedro> if (py)
Pedro> - {
Pedro> - Py_DECREF (py);
Pedro> - }
Pedro> + Py_DECREF (py);

The X is missing.

Also, as discussed on irc, if you do this you might as well zap
make_cleanup_py_xdecref and py_xdecref.

I think having one set of cleanup functions is plenty. The NULL check
can't cost much, either in performance or clarity.

Really I would prefer to get rid of decref cleanups at all, since they
mess with the checker. But this is a pain, and probably not worth the
effort unless we think we could really get to 0 false reports.

Tom