public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: bauermann@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: Use Unicode strings for command and completer arguments. Date: Thu, 05 Feb 2009 22:40:00 -0000 [thread overview] Message-ID: <20090205224055.16640.qmail@sourceware.org> (raw) The branch, archer-tromey-python has been updated via 56ce8a9af0d917bb7717e64ed9f5386ec64f9f22 (commit) via c5d0304916ac571e2132b58d26aa11a330885a61 (commit) from 945aa667ba5a3418910aff5c5f5a50a0eb686510 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 56ce8a9af0d917bb7717e64ed9f5386ec64f9f22 Author: Thiago Jung Bauermann <bauerman@br.ibm.com> Date: Thu Feb 5 20:13:24 2009 -0200 Use Unicode strings for command and completer arguments. * python/python-cmd.c (cmdpy_function): Convert command arguments to a Unicode string. (cmdpy_completer): Convert text and word arguments to a Unicode string. * python/lib/gdb/command/pahole.py (invoke): Raise a TypeError exception instead of a (deprecated) string. commit c5d0304916ac571e2132b58d26aa11a330885a61 Author: Thiago Jung Bauermann <bauerman@br.ibm.com> Date: Thu Feb 5 18:58:52 2009 -0200 Address Eli's review comments on the Value.string patch. * gdb.texinfo (Values From Inferior): Better explain Value.string's encoding argument. ----------------------------------------------------------------------- Summary of changes: gdb/ChangeLog | 9 +++++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 14 ++++++++------ gdb/python/lib/gdb/command/pahole.py | 2 +- gdb/python/python-cmd.c | 6 +++--- 5 files changed, 26 insertions(+), 10 deletions(-) First 500 lines of diff: diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9164bfa..014dea5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2009-02-05 Thiago Jung Bauermann <bauerman@br.ibm.com> + + * python/python-cmd.c (cmdpy_function): Convert command arguments to a + Unicode string. + (cmdpy_completer): Convert text and word arguments to a Unicode + string. + * python/lib/gdb/command/pahole.py (invoke): Raise a TypeError + exception instead of a (deprecated) string. + 2009-02-05 Tom Tromey <tromey@redhat.com> * python/lib/gdb/command/save_breakpoints.py diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 628b681..352870f 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-02-05 Thiago Jung Bauermann <bauerman@br.ibm.com> + + * gdb.texinfo (Values From Inferior): Better explain + Value.string's encoding argument. + 2009-02-05 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Commands In Python): Update for change to 'invoke' diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9392168..9cb07d8 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -18428,12 +18428,14 @@ array of characters or ints. The string is assumed to be terminated by a zero of the appropriate width. If the optional @var{encoding} argument is given, it must be a string -naming the encoding of the string in the @code{gdb.Value}. The Python -codec machinery will be used to convert the string. If @var{encoding} -is not given, or if @var{encoding} is the empty string, then either -the @code{target-charset} (@pxref{Character Sets}) will be used, or a -language-specific encoding will be used, if the current language is -able to supply one. +naming the encoding of the string in the @code{gdb.Value}, such as +@code{"ascii"}, @code{"iso-8859-6"} or @code{"utf-8"}. It accepts +the same encodings as the corresponding argument to Python's +@code{string.decode} method, and the Python codec machinery will be used +to convert the string. If @var{encoding} is not given, or if +@var{encoding} is the empty string, then either the @code{target-charset} +(@pxref{Character Sets}) will be used, or a language-specific encoding +will be used, if the current language is able to supply one. The optional @var{errors} argument is the same as the corresponding argument to Python's @code{string.decode} method. diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py index b159937..569b816 100644 --- a/gdb/python/lib/gdb/command/pahole.py +++ b/gdb/python/lib/gdb/command/pahole.py @@ -74,7 +74,7 @@ It prints the type and displays comments showing where holes are.""" type = gdb.Type (arg) type = self.strip (type) if type.code () != gdb.TYPE_CODE_STRUCT: - raise '%s is not a struct type' % arg + raise TypeError, '%s is not a struct type' % arg print ' ' * 14, self.pahole (type, 0, '') diff --git a/gdb/python/python-cmd.c b/gdb/python/python-cmd.c index 50f1141..50a283f 100644 --- a/gdb/python/python-cmd.c +++ b/gdb/python/python-cmd.c @@ -133,7 +133,7 @@ cmdpy_function (struct cmd_list_element *command, char *args, int from_tty) if (! args) args = ""; - argobj = PyString_FromString (args); + argobj = PyUnicode_Decode (args, strlen (args), host_charset (), NULL); if (! argobj) error (_("Could not convert arguments to Python string.")); @@ -194,10 +194,10 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word) goto done; } - textobj = PyString_FromString (text); + textobj = PyUnicode_Decode (text, strlen (text), host_charset (), NULL); if (! textobj) error (_("Could not convert argument to Python string.")); - wordobj = PyString_FromString (word); + wordobj = PyUnicode_Decode (word, strlen (word), host_charset (), NULL); if (! wordobj) error (_("Could not convert argument to Python string.")); hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2009-02-05 22:40 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090205224055.16640.qmail@sourceware.org \ --to=bauermann@sourceware.org \ --cc=archer-commits@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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).