From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +BphE6ucOGh8jTkAWB0awg (envelope-from ) for ; Thu, 29 May 2025 13:43:07 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=F9x7RuvQ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 421F81E11C; Thu, 29 May 2025 13:43:07 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 25EB71E102 for ; Thu, 29 May 2025 13:43:06 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4D03385828B for ; Thu, 29 May 2025 17:43:05 +0000 (GMT) Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 74DB83857C5F for ; Thu, 29 May 2025 17:42:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74DB83857C5F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 74DB83857C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748540560; cv=none; b=Nvw8kXESzfQs99CJiWBblFfaOsHtrDMvK7WQkOLcg9tvEuHsgHawhb9k8+tWAT2q/j+ARjbkX3cguUNMhWfVRF+BgdnG3ZbIT8dIc3bhNJbK1CxUFxD8IY5F+rSqL4gMccJUzDXxet8ED9LLWHpbr0Gx5mV89HRwp9AFSTBW6QA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748540560; c=relaxed/simple; bh=cHDewLvHSNwhIzxDyrQROwOoi7BNORjgbw0s4SzTuqs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xFwdkYN+e4zYntvVSISVGwEDv56k1iOFpIFs52nRwiw0D84s9mTrG4LmaEWucH9LWBGCOm1aD4AAXD8q+CdpauUVaGGAYHKFIJIt4KKwFXK8nEAbRM4d0qhx+I3AWdfGfPl0eJ5cG+15+KwbXJ8DTsxjwjVaJ+6JPebAlvc/DzE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74DB83857C5F Authentication-Results: sourceware.org; dkim=policy reason="signing key too small" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=F9x7RuvQ Received: from eig-obgw-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id KgEfubOvGiuzSKhH5uFfsL; Thu, 29 May 2025 17:42:40 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id KhH4uZxDO1vNyKhH5uUPZd; Thu, 29 May 2025 17:42:39 +0000 X-Authority-Analysis: v=2.4 cv=VMQWnMPX c=1 sm=1 tr=0 ts=68389c8f a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=UQyPwb99uToYW7-0:21 a=dt9VzEwgFbYA:10 a=ItBw4LHWJt0A:10 a=CCpqsmhAAAAA:8 a=8AHkEIZyAAAA:8 a=7CQSdrXTAAAA:8 a=BeyXvxMBXavPCPBodQMA:9 a=4A-poVjSEtQA:10 a=ul9cdbp4aOFLsgKbc677:22 a=a-qgeE7W1pNrGK8U0ZQC:22 a=VS4QxaUSPT0UtbFnIvSC:22 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:Date:References:In-Reply-To :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=1jq6ydtnOrsbxbB3n6uXLaMcs9SzIptwagJW1r4/NsY=; b=F9x7RuvQ66r/mWeWn88jZzTewM nYaAakOF1JpQHJNmyznxt/SGGAqL+Ai4PQqc1x7ijflCRC3JOMCz28ISxgP2nyiXlgqGV2VwIJL4p sFv3WDFPaIAck8HlgQ20P3i66; Received: from 97-118-46-156.hlrn.qwest.net ([97.118.46.156]:44496 helo=prentzel) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uKhH3-000000036Wz-47TE; Thu, 29 May 2025 11:42:38 -0600 From: Tom Tromey To: Matthieu Longo Cc: gdb@sourceware.org, Tamar Christina , Andre Simoes Dias Vieira , Tom Tromey , Simon Marchi , Luis Machado , Andrew Burgess Subject: Re: [RFC] Allowing GDB to use a more recent version of Python at runtime than it was compiled with In-Reply-To: <314abf0a-007c-457d-bcc3-c28384b9f098@arm.com> (Matthieu Longo's message of "Thu, 29 May 2025 17:14:07 +0100") References: <314abf0a-007c-457d-bcc3-c28384b9f098@arm.com> X-Attribution: Tom Date: Thu, 29 May 2025 11:42:35 -0600 Message-ID: <87ecw7b9f8.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.46.156 X-Source-L: No X-Exim-ID: 1uKhH3-000000036Wz-47TE X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-46-156.hlrn.qwest.net (prentzel) [97.118.46.156]:44496 X-Source-Auth: tom+tromey.com X-Email-Count: 8 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfAJP9Wl5rZ887mgDqIK3Zcz2uFNuE/xf6U8UX1GJbS5lKXAhpKJ4CtfoupxlpIJSklzNj51JSGEA39NdGJJA27GvVmcoU0F4Ma52wCBSY5th7Ct/h5UD J42ENT/xT2FhxS2Be+V5JggI5pgJZnaB7Ba2VMjTgAZC5qnHAHtnEOx21pvZVGtOFejvExqky2eKpw== X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" >>>>> "Matthieu" == Matthieu Longo writes: Matthieu> ## End goal Matthieu> Allowing GDB to use a more recent version of Python at runtime than it Matthieu> was compiled with. FWIW I've looked at this several times over the years. See: https://sourceware.org/bugzilla/show_bug.cgi?id=23830 Matthieu> I got errors about Py_buffer and PyBuffer_Release (part of the Stable Matthieu> ABI (including all members) since version 3.11, so changed Matthieu> Py_LIMITED_API to 0x030b0000): Matthieu> https://docs.python.org/3/c-api/buffer.html#c.Py_buffer This is new since the last time I looked. Note that gdb still supports a very old Python by default -- like 3.4 I think. This is bad but it is hard to change. Matthieu> There might be more issues as the build process stopped and didn't go Matthieu> over all the files in gdb/python. Yeah, there's the readline stuff mentioned in the bug. Maybe this could be disabled. One idea might be to have a configure flag requesting the stable API and then just drop this module in this case. This idea might 'interface' with the 3.4 requirement above. Like, we can have a fallback mode in the source for people building against older versions of Python. Matthieu> Making the usage of PyTypeObject opaque would consist in transforming Matthieu> the declaration of those PyTypeObjects to a static PyType_Slot and Matthieu> PyType_Spec equivalent, and then creating a PyObject* by calling Matthieu> PyType_FromSpec() instead of PyModule_AddObject(), which is, by the Matthieu> way, "soft deprecated" since Python 3.13. Yes, converting to PyType_FromSpec would be fine. Matthieu> Following the logic of PEP-384, linking against the Python limited C Matthieu> API means linking against libpython3.so, not libpython3.x.so Matthieu> With in the current state of Python packaging, this creates issues at Matthieu> different stages: I don't know what to do about this one. But I guess one idea would be that gdb could adopt the changes that make sense, and then you could handle the build-time madness for your own builds. Then this could be improved in gdb as the upstream Python/distro situation develops. Matthieu> - testing. I have had a look at the test coverage of the Python GDB Matthieu> API, and it seems ok at a first glance. Please let me know if you Matthieu> can see any difficulty with the current coverage. How did you test coverage? I used to routinely to --coverage builds and test these, but they haven't been reliable for me for a couple of years now :-( Matthieu> - any performance impact caused by this transition that I should be Matthieu> aware of. And how did you measure it ? How critical are performances Matthieu> regarding the Python limited C API ? I would not worry about this at all. Feel free to update the bug with your findings. Also if you send patches, of course mention the bug so it's auto-updated. good luck, Tom