From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 14N3HsBTB2qXrT0AWB0awg (envelope-from ) for ; Fri, 15 May 2026 13:11:28 -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=v4hwz/Bc; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5CDDA1E0B1; Fri, 15 May 2026 13:11:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 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_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 9BCD51E067 for ; Fri, 15 May 2026 13:11:27 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9FF1851A4337 for ; Fri, 15 May 2026 17:11:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FF1851A4337 Authentication-Results: sourceware.org; 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=v4hwz/Bc Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 37D8F4BA2E15 for ; Fri, 15 May 2026 17:11:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37D8F4BA2E15 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 37D8F4BA2E15 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778865061; cv=none; b=NEKdPEWBvO1+0yAgamZrzk5LhIzKG2EtUeZUa1FfKqHboi2aCZ03+aLli0a+u+U7JnZ6oynG2YofstJwx+5mIRiDwPgpzfiKrz3i6lbCfO6vHByD1JCDjzTmVZzgRXcI/c7kh8lAPDpJEl6aqeaCjN+BTScy28YiEScY9sM+C5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778865061; c=relaxed/simple; bh=MRrhRKqgSI8XqI/gTGDa3girWW/5t81AHJgq0pQINVY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XpwwWR41LTZ3K2qymkHlXI6cpY2a39C9IQnozbh7BTr6LMcnMEogVD1FzLA+A1Ok1mt6cOMFpL+N3Hb/vvt7fS7FShmFRqZFj1EnpuOo3WC9dzppBNv2zg7dfS8sE9RRG64zvOih3h2aajo989KOw3mOjm4FAt9zwRfXJSGKDtc= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=v4hwz/Bc reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37D8F4BA2E15 Received: from eig-obgw-5001b.ext.cloudfilter.net ([10.0.29.181]) by cmsmtp with ESMTPS id Ne67wFl3N4RkpNw3wwq62c; Fri, 15 May 2026 17:11:00 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Nw3vwNGmLsO4mNw3wwEiB3; Fri, 15 May 2026 17:11:00 +0000 X-Authority-Analysis: v=2.4 cv=LreSymdc c=1 sm=1 tr=0 ts=6a0753a4 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=NGcC8JguVDcA:10 a=ItBw4LHWJt0A:10 a=20KFwNOVAAAA:8 a=zstS-IiYAAAA:8 a=fiFB0wJo7qbq2dPgtOEA:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=DCx65vhANUyCzuf5D8fC: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=Yn9edRAwkhT+K8NAX2kvSfkmLKzWLt28f8VvNk8n68M=; b=v4hwz/Bc0RTrj7BJGT37KTyNTx B5anB8fkWX20nE5VQdIsD1+j2hSDUBChRQ/Ba76vM8gW2iqq/uX4LrWESIMBiPy3Zd3byVqTBnp6G zCtlyFA/0eXe/eFLFy+fDD7H1; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:53104 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wNw3v-00000001MPB-1k67; Fri, 15 May 2026 11:10:59 -0600 From: Tom Tromey To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] gdb/python: add type traits check for all PyObject sub-classes In-Reply-To: <491de87828ea40daa77a485da4e14e476e0c7a1d.1778839043.git.aburgess@redhat.com> (Andrew Burgess's message of "Fri, 15 May 2026 11:00:46 +0100") References: <491de87828ea40daa77a485da4e14e476e0c7a1d.1778839043.git.aburgess@redhat.com> X-Attribution: Tom Date: Fri, 15 May 2026 11:10:58 -0600 Message-ID: <87tss8ha3h.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: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wNw3v-00000001MPB-1k67 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:53104 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDPSIfxr1LXRqsnJ0lZ3xFKsRf3v9FZzPdBovf4bRvbhjrVgjOqJ7MdjqZ2XffXTOO21Z36IVPy4fApu+oTRyJEgZVjG4CBn4w3xMA/oQ7B+GRfdL9to gcPV5ItOA2c/sd64ykjO5oBlDqmeS78ZSrsyFWSyutBwBqdueDw83G3+mTrH4LqbXBhDSfuVXk3z7WXbtwXG5632xgI9s54zxAs= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org >>>>> "Andrew" == Andrew Burgess writes: Andrew> The problem is that Python is written in C, and PyObject_New doesn't Andrew> call any constructors for `some_new_type`, nor for any of the fields Andrew> within `some_new_type`. Since working on the Python safety series, I have been wondering if we could remedy this. That is, give gdb's classes constructors and destructors and arrange for these to be called in-place in tp_init / whatever the destroy one is. This way we could use idiomatic gdb code, which would be safer. I was planning to investigate this more deeply once Matthew Longo's work was done, since I didn't want to touch all the type objects and cause conflicts. Andrew> + Andrew> +template Andrew> +struct is_python_allocatable { Andrew> + static constexpr bool value = Andrew> + std::is_trivially_destructible_v && Andrew> + std::is_trivially_copyable_v; Brace and operator placement. Otherwise this looks good to me. If the tp_init experiment works out I suppose we may end up reverting this. But IMO it's best not to wait on something that might not happen. Approved-By: Tom Tromey Tom