This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Compilation regression with python-2.6 [Re: [PATCH 24/28] introduce gdb_pymodule_addobject]
- From: Tom Tromey <tromey at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>, gdb-patches at sourceware dot org
- Date: Tue, 21 May 2013 10:36:46 -0600
- Subject: Re: [patch] Compilation regression with python-2.6 [Re: [PATCH 24/28] introduce gdb_pymodule_addobject]
- References: <87ehe638ww dot fsf at fleche dot redhat dot com> <8761ziy43f dot fsf at fleche dot redhat dot com> <20130521075803 dot GA404 at host2 dot jankratochvil dot net> <519B9B54 dot 9090907 at redhat dot com> <20130521161400 dot GA2763 at host2 dot jankratochvil dot net> <519B9F9A dot 9070600 at redhat dot com>
>>>>> "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