Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC][python] Fixes and improvements to gdb.Value.
Date: Sat, 03 Jan 2009 09:42:00 -0000	[thread overview]
Message-ID: <u7i5cohf7.fsf@gnu.org> (raw)
In-Reply-To: <1230949500.8380.140.camel@localhost.localdomain>

> From: Thiago Jung Bauermann <bauerman@br.ibm.com>
> Date: Sat, 03 Jan 2009 00:24:59 -0200
> 
> This patch has fixes and improvements made to the value python bindings
> that have been made in the python branch since this code has been
> committed to CVS. Ok?

Thanks.

> gdb/doc/
> 2009-01-03  Tom Tromey  <tromey@redhat.com>
> 
> 	* gdb.texinfo (Basic Python): Document gdb.history.

This part is approved, but I have a few comments:

> +@findex gdb.history

The text below this does not mention "gdb.history" at all.  Should it?
I could imagine a reader who gets here by following the "gdb.history"
index entry, and is then puzzled by not finding that text anywhere.

> +If @var{number} is less than or equal to zero, then @value{GDBN} will
> +take the absolute value of @var{number} and count backward from the
> +last element to find the value to return.

For clarity, I'd separate the zero case and the negative case.  First,
"is less than or equal to zero" is a mouthful that would be eliminated
then; you could simply say "negative".  And second, "count zero
elements backward" is an abstraction that is a better avoided.

>                                             If there is no such element
> +in the value history, an exception will be raised.

Should we say which exception will be raised, and perhaps have a
cross-reference to where exceptions raised in Python code are
described?

> +The return value is always an instance of @code{gdb.Value}
> +(@pxref{Values From Inferior}).
> +@end defun

I'd modify this thusly:

  If no exception is raised, the return value is always an instance of
  @code{gdb.Value} (@pxref{Values From Inferior}).

The point is that we should be crystal clear that a value is returned
only if there's no exception (since there are languages where an
exception, too, can return a value), and that "always" does not
include the case with an exception.

> +   string object converted to a named charset.  If an error occurs during
>     the conversion, NULL will be returned and a python exception will be set.
>  
>     The caller is responsible for xfree'ing the string.  */
> -char *
> -unicode_to_target_string (PyObject *unicode_str)
> +static char *
> +unicode_to_encoded_string (PyObject *unicode_str, const char *charset)

I think our convention is to up-case references to arguments in
comments that describe the function.  So please use "named CHARSET" in
the above comment.

> +/* Converts a python string (8-bit or unicode) to a target string in

Is 8-bit and Unicode the only 2 alternatives here?  IOW, doesn;t this
support Far Eastern multibyte encodings, such as ISO-2022, Big-5,
etc.?  Sorry if I'm talking nonsense out of ignorance about Python's
support of non-ASCII characters.


  reply	other threads:[~2009-01-03  9:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-03  2:25 Thiago Jung Bauermann
2009-01-03  9:42 ` Eli Zaretskii [this message]
2009-01-03 23:09   ` Thiago Jung Bauermann
2009-01-04  4:20     ` Eli Zaretskii
2009-01-05 21:01     ` Tom Tromey
2009-01-29 14:16       ` Thiago Jung Bauermann
2009-02-02 13:06 [RFA][python] Fixes for existing Python code Thiago Jung Bauermann
2009-02-02 18:30 ` Tom Tromey
2009-02-04  1:01   ` [RFC][python] Fixes and improvements to gdb.Value. (was Re: [RFA][python] Fixes for existing Python code.) Thiago Jung Bauermann
2009-02-04 19:40     ` [RFC][python] Fixes and improvements to gdb.Value Tom Tromey
2009-02-04 21:57       ` Thiago Jung Bauermann

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=u7i5cohf7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=bauerman@br.ibm.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