From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38870 invoked by alias); 20 Feb 2019 18:13:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 38835 invoked by uid 89); 20 Feb 2019 18:13:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=2.4, Hx-languages-length:1875 X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.251) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Feb 2019 18:13:37 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway24.websitewelcome.com (Postfix) with ESMTP id AB53563AD8 for ; Wed, 20 Feb 2019 12:13:36 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id wWNEg2EF4YTGMwWNEgKPQv; Wed, 20 Feb 2019 12:13:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4eIisu7b1+3rCg3FaL4BPY+nlgkVMcePizuiwFuJfYQ=; b=QUrwdJe/7xm5Tv/LKrk7+N1dyE y/pMW6+bVsPn+GxMfiBULTg5kG0iGn1t68QyRXxWKH2ZJC4yNwdy37uFG4pbQN2886V9sfahevDFj eIWtSNJwdsS8YHeCdjFrTHEop; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:42970 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gwWNE-003KJY-Dj; Wed, 20 Feb 2019 12:13:36 -0600 From: Tom Tromey To: Kevin Buettner Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Use Python 2.[67] / 3.X / PEP 3118 buffer protocol References: <20190219145110.03bccce6@f29-4.lan> Date: Wed, 20 Feb 2019 18:13:00 -0000 In-Reply-To: <20190219145110.03bccce6@f29-4.lan> (Kevin Buettner's message of "Tue, 19 Feb 2019 14:51:10 -0700") Message-ID: <87ftsipbu8.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-02/txt/msg00335.txt.bz2 >>>>> "Kevin" == Kevin Buettner writes: Kevin> This patch removes the non-IS_PY3K code in infpy_write_memory() Kevin> and infpy_search_memory(). In both cases, the remaining code Kevin> from these ifdefs is related to use of the PEP 3118 buffer protocol. Kevin> (Deleted code is either due to simplification or related to use of the Kevin> old buffer protocol.) PEP 3118 is sometimes referred to as the "new" Kevin> buffer protocol, though it's not that new anymore. Thanks for doing this. Kevin> The link below describes new features in Python 2.6. In particular, Kevin> it says that the buffer protocol described by PEP 3118 is in Python Kevin> 2.6. It also says (at the top of the page) that Python 2.6 was Kevin> released on Oct 1, 2008. I think probably the NEWS file should be updated to mention the minimum version bump. gdb.texinfo also currently says that Python 2.4 is the minimum, so that should also be updated. Kevin> I have tested against both Python 2.7.15 and 3.7.2. I see no Kevin> regressions among the non-racy tests. I've also verified that Kevin> PyBuffer_Release is being called when the affected functions exit Kevin> while running the tests in gdb.python/py-inferior.exp by hand. I've Kevin> also tried running valgrind on GDB while running this test, but I'm Kevin> puzzled by the results that I'm seeing - I'm seeing no additional Kevin> leaks when I comment out the Py_buffer_up lines that I introduced. Maybe it's possible that PyBuffer_Release doesn't need to do anything in particular in some scenarios? Like if the buffer it refers to is shared with some other object? You'd have to dive into the Python implementation to find out. Meanwhile if there is no leak introduced by this code, then it seems fine to me. The patch itself looks good to me. Tom