From patchwork Mon May 23 17:25:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 12473 Received: (qmail 35043 invoked by alias); 23 May 2016 17:25:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 34965 invoked by uid 89); 23 May 2016 17:25:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, FSL_HELO_HOME, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=H*m:tromey, H*m:tom, Hx-languages-length:1531 X-HELO: gproxy2-pub.mail.unifiedlayer.com Received: from gproxy2-pub.mail.unifiedlayer.com (HELO gproxy2-pub.mail.unifiedlayer.com) (69.89.18.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Mon, 23 May 2016 17:25:23 +0000 Received: (qmail 25978 invoked by uid 0); 23 May 2016 17:25:21 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy2.mail.unifiedlayer.com with SMTP; 23 May 2016 17:25:21 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id xtRG1s00j2f2jeq01tRKL7; Mon, 23 May 2016 11:25:19 -0600 X-Authority-Analysis: v=2.1 cv=QND7GG7L c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=_v2sUkyEFrwA:10 a=yrkiwgmsf1kA:10 a=zstS-IiYAAAA:8 a=4TjWFc6nhqm_tE5gcAgA:9 a=FBCi7cgBu1Ke1Lg_:21 a=69QJAR00EMpLERW7:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from [71.215.116.141] (port=40406 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1b4tbS-0007wu-4D; Mon, 23 May 2016 11:25:18 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 1/2] add nb_inplace_divide for python 2 Date: Mon, 23 May 2016 11:25:12 -0600 Message-Id: <1464024313-11932-2-git-send-email-tom@tromey.com> In-Reply-To: <1464024313-11932-1-git-send-email-tom@tromey.com> References: <1464024313-11932-1-git-send-email-tom@tromey.com> X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 71.215.116.141 authed with 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 * 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 + * python/py-value.c (value_object_as_number): Add + nb_inplace_divide for Python 2. + +2016-05-23 Tom Tromey + 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 */