public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-python: Use Unicode strings for command and completer arguments.
@ 2009-02-05 22:40 bauermann
  0 siblings, 0 replies; only message in thread
From: bauermann @ 2009-02-05 22:40 UTC (permalink / raw)
  To: archer-commits

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-05 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-05 22:40 [SCM] archer-tromey-python: Use Unicode strings for command and completer arguments bauermann

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).