This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Implement floordiv operator for gdb.Value


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]