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: Tue, 13 Nov 2012 18:53:00 -0000 [thread overview]
Message-ID: <87390d8hdf.fsf@fleche.redhat.com> (raw)
In-Reply-To: <C75A84166056C94F84D238A44AF9F6AD29D1BF@AUSX10MPC103.AMER.DELL.COM> (Paul Koning's message of "Mon, 12 Nov 2012 21:37:18 +0000")
>>>>> "Paul" == <Paul_Koning@Dell.com> writes:
Paul> Because PyModule_Create returns a new reference, while Py_InitModule
Paul> returns a borrowed reference (bletch).
Oh, yeah, it is obvious now :) Thanks.
[...]
Paul> Or Py_TYPE (self)->tp_free (self) -- less change from the existing
Paul> code. That argument doesn't need a cast, the signature is tp_free
Paul> (void *).
Oops, yeah, that is what I meant.
Paul> + wchar_t *progname_copy;
Tom> Can we really assume a working wchar_t?
Paul> Yes, you'd expect a configure check or the like. But the header files
Paul> for Python reference that type without any checks that I can see.
Paul> Similarly mbstowcs(). It looks like you can't built Python 3 if those
Paul> aren't defined (which makes some sense -- how else could you build a
Paul> program that uses Unicode for all its strings?).
Ok, I think that is sufficient.
If Python ever adds checks, and we hit such a such a system, we can fix
it up then.
It is a little weird since wchar_t isn't guaranteed to have anything to
do with Unicode. But I assume they know what they are doing.
Paul> Ok. That code was adapted from Python 3 code which does it this way.
Paul> The existing code in python.c calls a whole string of API calls (like
Paul> PyModule_AddStringConstant) without checking the error status from any
Paul> of them. Should I add those, with the failure action being to disable
Paul> Python support in GDB?
I'm not sure what to do about those. I guess failing gracefully would
be better than what we do now.
FWIW I'm not sure we really have a way to disable Python at runtime yet.
And to be clear, I don't expect you to add this as part of your patch.
Mostly I just want to avoid an 'exit' on a failure to initialize -- it
is better for gdb to try to limp along in this situation.
Paul> Index: py-inferior.c
[...]
Paul> GDB_PY_HANDLE_EXCEPTION (except);
Paul> +#ifdef IS_PY3K
Paul> + PyBuffer_Release (pybuf);
Paul> +#endif
GDB_PY_HANDLE_EXCEPTION can return, so cleaning up has to be handled
there as well somehow.
Maybe this is an issue in the other spot, too, I couldn't tell
immediately.
Tom
next prev parent reply other threads:[~2012-11-13 18:53 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 [this message]
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
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=87390d8hdf.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