From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA v2 1/2] add nb_inplace_divide for python 2
Date: Mon, 23 May 2016 17:25:00 -0000 [thread overview]
Message-ID: <1464024313-11932-2-git-send-email-tom@tromey.com> (raw)
In-Reply-To: <1464024313-11932-1-git-send-email-tom@tromey.com>
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-23 Tom Tromey <tom@tromey.com>
* python/py-value.c (value_object_as_number): Add
nb_inplace_divide for Python 2.
---
gdb/ChangeLog | 5 +++++
gdb/python/py-value.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 07bc5d2..5142429 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-05-23 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/19438, PR python/18393:
* python/py-objfile.c (objfpy_initialize): Initialize self->dict.
* python/py-progspace.c (pspy_initialize): Initialize self->dict.
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 */
--
2.5.5
next prev parent reply other threads:[~2016-05-23 17:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 17:25 [RFA v2 0/2] Fix PR python/17386 - add __index__ method to gdb.Value Tom Tromey
2016-05-23 17:25 ` [RFA v2 2/2] " Tom Tromey
2016-05-23 18:01 ` Pedro Alves
2016-05-23 18:40 ` Tom Tromey
2016-05-24 8:58 ` Yao Qi
2016-05-25 13:48 ` Ulrich Weigand
2016-05-25 14:04 ` Tom Tromey
2016-05-25 14:54 ` Ulrich Weigand
2016-05-23 17:25 ` Tom Tromey [this message]
2016-05-24 8:50 ` [RFA v2 1/2] add nb_inplace_divide for python 2 Yao Qi
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=1464024313-11932-2-git-send-email-tom@tromey.com \
--to=tom@tromey.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