From: Tom Tromey <tromey@redhat.com>
To: <Paul_Koning@Dell.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Python 3 support, part 1 (non-testsuite part)
Date: Mon, 19 Nov 2012 16:49:00 -0000 [thread overview]
Message-ID: <87ip91r12k.fsf@fleche.redhat.com> (raw)
In-Reply-To: <C75A84166056C94F84D238A44AF9F6AD29FC5D@AUSX10MPC103.AMER.DELL.COM> (Paul Koning's message of "Wed, 14 Nov 2012 16:03:22 +0000")
>>>>> "Paul" == <Paul_Koning@Dell.com> writes:
Paul> Here is an updated patch which I believe addresses all the comments.
Thanks.
Paul> Should I add a NEWS entry for the Python 3 support?
Yes, that would be good.
Paul> PyTypeObject breakpoint_object_type =
Paul> {
Paul> - PyObject_HEAD_INIT (NULL)
Paul> - 0, /*ob_size*/
Paul> + PyVarObject_HEAD_INIT (NULL, 0)
The new line has the wrong indentation.
Paul> static PyTypeObject cmdpy_object_type =
Paul> {
Paul> - PyObject_HEAD_INIT (NULL)
Paul> - 0, /*ob_size*/
Paul> + PyVarObject_HEAD_INIT (NULL, 0)
Ditto.
Paul> PyTypeObject event_object_type =
Paul> {
Paul> - PyObject_HEAD_INIT (NULL)
Paul> - 0, /* ob_size */
Paul> + PyVarObject_HEAD_INIT (NULL, 0)
Ditto.
Paul> static PyTypeObject eventregistry_object_type =
Paul> {
Paul> - PyObject_HEAD_INIT (NULL)
Paul> - 0, /* ob_size */
Paul> + PyVarObject_HEAD_INIT (NULL, 0)
Ditto.
Paul> + if (except.reason < 0)
Paul> + PyBuffer_Release (&pybuf);
Paul> GDB_PY_HANDLE_EXCEPTION (except);
Paul> +#ifdef IS_PY3K
Paul> + PyBuffer_Release (&pybuf);
Paul> +#endif
I think the first PyBuffer_Release also has to be conditional on IS_PY3K
here.
It seems like you could just always call it after the try-catch rather
than checking except.reason.
Paul> +#ifdef IS_PY3K
Paul> +static int
Blank line between these two.
Paul> @@ -638,6 +698,10 @@
Paul> }
Paul> GDB_PY_HANDLE_EXCEPTION (except);
Paul> +#ifdef IS_PY3K
Paul> + PyBuffer_Release (&pybuf);
Paul> +#endif
It seems like PyBuffer_Release must be called before
GDB_PY_HANDLE_EXCEPTION here.
Paul> +#ifdef IS_PY3K
Paul> +static PyBufferProcs buffer_procs = {
Blank line between these two, and I think "{" on its own line is
generally preferred.
Paul> +++ gdb/python/py-value.c 14 Nov 2012 15:57:17 -0000
Paul> @@ -106,7 +106,7 @@
Paul> Py_XDECREF (self->dynamic_type);
Paul> - self->ob_type->tp_free (self);
Paul> + obj->ob_type->tp_free (self);
Paul> }
Doesn't this need the new Py_TYPE macro?
Paul> +/* FIXME: there are a lot of calls below that do not check the return
Paul> + value for errors. */
Don't bother with the new FIXME.
Paul> + int python_init_ok = 0;
This seems to be unused.
Paul> + progname_copy = PyMem_Malloc ((progsize + 1) * sizeof (wchar_t));
[...]
Paul> + Py_SetProgramName (progname_copy);
I think a comment here explaining why we never free progname_copy would
be nice to have.
thanks,
Tom
next prev parent reply other threads:[~2012-11-19 16:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 16:06 Paul_Koning
2012-11-12 20:43 ` Tom Tromey
2012-11-12 21:37 ` Paul_Koning
2012-11-13 18:53 ` Tom Tromey
2012-11-13 19:02 ` Paul_Koning
2012-11-13 19:12 ` Tom Tromey
2012-11-13 19:26 ` Paul_Koning
2012-11-13 19:43 ` Tom Tromey
2012-11-13 19:56 ` Paul_Koning
2012-11-13 20:24 ` Tom Tromey
2012-11-14 16:03 ` Paul_Koning
2012-11-19 16:49 ` Tom Tromey [this message]
2012-12-11 20:22 ` Paul_Koning
2012-12-11 20:37 ` Eli Zaretskii
2012-12-11 21:24 ` Tom Tromey
2012-12-12 17:00 ` Paul_Koning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ip91r12k.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=Paul_Koning@Dell.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox