From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16683 invoked by alias); 5 Feb 2009 22:40:58 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 16655 invoked by uid 9723); 5 Feb 2009 22:40:56 -0000 Date: Thu, 05 Feb 2009 22:40:00 -0000 Message-ID: <20090205224055.16640.qmail@sourceware.org> From: bauermann@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: Use Unicode strings for command and completer arguments. X-Git-Refname: refs/heads/archer-tromey-python X-Git-Reftype: branch X-Git-Oldrev: 945aa667ba5a3418910aff5c5f5a50a0eb686510 X-Git-Newrev: 56ce8a9af0d917bb7717e64ed9f5386ec64f9f22 X-SW-Source: 2009-q1/txt/msg00117.txt.bz2 List-Id: 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 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 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 + + * 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 * 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 + + * gdb.texinfo (Values From Inferior): Better explain + Value.string's encoding argument. + 2009-02-05 Tom Tromey * 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.