Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: <Paul.Koning@dell.com>
To: <jwakely@redhat.com>
Cc: <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Implement floordiv operator for gdb.Value
Date: Tue, 20 Sep 2016 19:06:00 -0000	[thread overview]
Message-ID: <1BF475D4-EC47-4C40-8C87-2C47B1C89F2A@dell.com> (raw)
In-Reply-To: <20160920171107.GE5736@redhat.com>


> On Sep 20, 2016, at 1:11 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
> 
> On 20/09/16 17:00 +0000, Paul.Koning@dell.com wrote:
>> 
>>> On Sep 20, 2016, at 12:35 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
>>> 
>>>> ...
>>> 
>>> This seems to be an existing property of gdb.Value, as even using the
>>> normal division operator (and without my patch) I see floats printed
>>> without a decimal part when they are an integer value:
>>> 
>>> (gdb) python print (gdb.Value(5.0)/5.0)
>>> 1
>>> (gdb) python print (5.0/5.0)
>>> 1.0
>> 
>> In all this, please keep in mind that this is one place where Python 2 and Python 3 differ:
> 
> Right, see https://sourceware.org/ml/gdb-patches/2016-09/msg00221.html
> for a crazy idea that would make gdb.Value match the Python version
> it's built against.
> 
> That wouldn't help for Python 2 using __future__ division though.

Yes.  You'd expect that this would be easy to find, but that isn't the case.  It may be accessible from C code, if you can find the parser flags from where you are.  Look for CO_FUTURE in the source tree.

	paul


      reply	other threads:[~2016-09-20 18:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 13:34 Jonathan Wakely
2016-09-20 14:46 ` Jonathan Wakely
2016-09-20 15:41 ` Pedro Alves
2016-09-20 16:41   ` Jonathan Wakely
2016-09-20 16:42     ` Jonathan Wakely
2016-09-20 17:01     ` Pedro Alves
2016-09-20 17:11       ` Jonathan Wakely
2016-09-20 17:08     ` Paul.Koning
2016-09-20 18:20       ` Jonathan Wakely
2016-09-20 19:06         ` Paul.Koning [this message]

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=1BF475D4-EC47-4C40-8C87-2C47B1C89F2A@dell.com \
    --to=paul.koning@dell.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jwakely@redhat.com \
    --cc=palves@redhat.com \
    /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