From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8YA7MIr9eGlvUhgAWB0awg (envelope-from ) for ; Tue, 27 Jan 2026 13:01:46 -0500 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=neLwwa+e; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C20041E0DD; Tue, 27 Jan 2026 13:01:46 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no 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 56CFB1E08D for ; Tue, 27 Jan 2026 13:01:46 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id DA0044BA2E2F for ; Tue, 27 Jan 2026 18:01:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA0044BA2E2F 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=neLwwa+e Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id B83234BA9025 for ; Tue, 27 Jan 2026 18:01:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B83234BA9025 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 B83234BA9025 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769536878; cv=none; b=eL3NEDp+2628tS6PGF+j7z1Tc6KKvpq05mcsZCqfccQCowS4JIN+QckK7aHLmZWYradxl4e/0xoVDNz+FhXY+Y3samUcxi+/ac59jF2ugHQx3VwmpvzW9a+RSUyvkRNvcEZfW9ya7v+IQFgBVMJblxwo3/Pitn/32RPs/wPjU4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769536878; c=relaxed/simple; bh=Q4gIQdM4nLFfYiSMYwnMyHwpLdeihplOYGrU1WJeHsA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IdzAuQhn2fmglowmTjyZSeLvAmh4nGas14YTlGco/eK7g1ivIRkueHGYjxp98oQpFgrQgYAeXfblUfRuLTogwN7sQdJE4lATdj4X+3h6Pnb4KyeJhWatyvdfoxnnjmkBfLSBb25TT1Vezl1rZZTvi8IM+sWWYSSOptOIr3pgEFk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B83234BA9025 Received: from eig-obgw-6001b.ext.cloudfilter.net ([10.0.30.143]) by cmsmtp with ESMTPS id kevcvpucmKXDJknNOvjd5f; Tue, 27 Jan 2026 18:01:18 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id knNNvCDq3cu11knNNv1wst; Tue, 27 Jan 2026 18:01:18 +0000 X-Authority-Analysis: v=2.4 cv=bKYWIO+Z c=1 sm=1 tr=0 ts=6978fd6e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=vUbySO9Y5rIA:10 a=ItBw4LHWJt0A:10 a=7CQSdrXTAAAA:8 a=zstS-IiYAAAA:8 a=-NkzDzAjeAlG4t00hBYA:9 a=a-qgeE7W1pNrGK8U0ZQC:22 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=Q4gIQdM4nLFfYiSMYwnMyHwpLdeihplOYGrU1WJeHsA=; b=neLwwa+eUBWEns+DPxRBc3pgcy NyoDZL/ggMZXCWY0fgl1XTjn9KFrJIv3LcO4S66VyQLPh2lEnZnXhalBKIcYulOTDF07KYgHNCYqA 2aFnKktRvkiO7ylYC4SYHxJzO; Received: from 97-122-114-32.hlrn.qwest.net ([97.122.114.32]:37516 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vknNN-00000000QKr-1lhw; Tue, 27 Jan 2026 11:01:17 -0700 From: Tom Tromey To: Matthieu Longo Cc: , Tom Tromey Subject: Re: [PATCH v2 3/6] gdbpy_registry: cast C extension type object to PyObject * before Py_XINCREF In-Reply-To: <20260127170215.1803582-4-matthieu.longo@arm.com> (Matthieu Longo's message of "Tue, 27 Jan 2026 17:02:12 +0000") References: <20260127170215.1803582-1-matthieu.longo@arm.com> <20260127170215.1803582-4-matthieu.longo@arm.com> X-Attribution: Tom Date: Tue, 27 Jan 2026 11:01:16 -0700 Message-ID: <87pl6v9bpv.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.122.114.32 X-Source-L: No X-Exim-ID: 1vknNN-00000000QKr-1lhw X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-114-32.hlrn.qwest.net (bapiya) [97.122.114.32]:37516 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEXHzvdm++g5ax5RhAVjhylbFSw1pxETm1N3FWO57WHfT1fuYo37RNNdD5mb1K/z+HDI4QFbwiZXnXRaSOeN/csVrOj+jYzt+9MSOOBhHfch38pZK7TR UkE5wtf6i3QQc9BsDUvQq2KnEcddakxG9h+T2Z162VZ8vyzAtaPgFrWW6SweG0Y87R0nzHoOBtvlyVnggovBF1csdywDNDxto28= 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 >>>>> "Matthieu" == Matthieu Longo writes: Matthieu> This patch fixes the resulting compilation issue by adding an explicit Matthieu> static_cast to 'PyObject *' before passing the value to Py_XINCREF(). Matthieu> As a side effect, this cast enforces, at compile time, that the template Matthieu> type 'Storage::obj_type' passed to gdbpy_registry is a subclass of Matthieu> PyObject. To provide a clearer diagnostic when an incorrect type is used, Matthieu> a static_assert is added to gdbpy_registry, avoiding obscure errors Matthieu> originating from the static_cast. Finally, the relevant C extension types Matthieu> passed to gdbpy_registry are updated to inherit publicly from PyObject. Thanks, this looks nice. I suspect the static_cast isn't needed, but I think it also isn't harmful, especially with the static assert in place. Approved-By: Tom Tromey Tom