This is the mail archive of the gdb-cvs@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]

[binutils-gdb] add nb_inplace_divide for python 2


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e2b7f516fc688975ea22ad3cf2066c6972454fdc

commit e2b7f516fc688975ea22ad3cf2066c6972454fdc
Author: Tom Tromey <tom@tromey.com>
Date:   Mon May 23 10:58:51 2016 -0600

    add nb_inplace_divide for python 2
    
    Python 2's PyNumberMethods has nb_inplace_divide, but Python 3 does
    not.  This patch adds it for Python 2.
    
    This buglet didn't cause much fallout because the only non-NULL entry
    in value_object_as_number after this is for valpy_divide; and the
    missing slot caused it to slide up to nb_floor_divide (where
    nb_true_divide was intended).
    
    2016-05-24  Tom Tromey  <tom@tromey.com>
    
    	* python/py-value.c (value_object_as_number): Add
    	nb_inplace_divide for Python 2.

Diff:
---
 gdb/ChangeLog         | 5 +++++
 gdb/python/py-value.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9359532..a38b98c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-24  Tom Tromey  <tom@tromey.com>
+
+	* python/py-value.c (value_object_as_number): Add
+	nb_inplace_divide for Python 2.
+
 2016-05-23  Tom Tromey  <tom@tromey.com>
 
 	PR python/17981:
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 7dba0ad..268f6c8 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -1827,6 +1827,9 @@ static PyNumberMethods value_object_as_number = {
   NULL,                       /* nb_inplace_add */
   NULL,                       /* nb_inplace_subtract */
   NULL,                       /* nb_inplace_multiply */
+#ifndef IS_PY3K
+  NULL,                       /* nb_inplace_divide */
+#endif
   NULL,                       /* nb_inplace_remainder */
   NULL,                       /* nb_inplace_power */
   NULL,                       /* nb_inplace_lshift */


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