From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yYT+BD4Fq2lLGxkAWB0awg (envelope-from ) for ; Fri, 06 Mar 2026 11:47:58 -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=geoj3bbl; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0EDEF1E0DD; Fri, 06 Mar 2026 11:47:58 -0500 (EST) 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 72A4A1E089 for ; Fri, 06 Mar 2026 11:47:57 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 907BF4BA23D1 for ; Fri, 6 Mar 2026 16:47:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 907BF4BA23D1 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=geoj3bbl Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id CD9FD4BA23FD for ; Fri, 6 Mar 2026 16:47:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CD9FD4BA23FD 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 CD9FD4BA23FD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772815634; cv=none; b=fYvP8nnMs98CnMLVTXczj8GRhVgPaxUDszOotqK8guQ6iIopsLFqYwWJ98NEJSmBSQvMXl98aLS5ggXVmcBhs3ESEh355tylsL2ycEpAVsl8gU5gTsw6G8uWhd8nTQxGuL4xSjZJwpG8E7zL924T8q7VJKLB6FR6RY31Soi4dxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772815634; c=relaxed/simple; bh=2nXgpLwprkqOQESBfeI/6mLr46p0XrdznJYg7uJFz8o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dLUSnXl2llqIfjKE2b5B/6N1XK7K2y4ce8fb2vfyRThhYDDJtqErzBDSXOx0AxL707PbgA5rB5AJdBmmlKSlef2sU0PgZvQwKUHiGCx0v8x2Q/m9f/uZ+ruhNC0pX/HJJm+ge77bKkfUBHwJlynQab3mV5ruw2s9cI1BtQGqYJU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD9FD4BA23FD Received: from eig-obgw-6007b.ext.cloudfilter.net ([10.0.30.166]) by cmsmtp with ESMTPS id yW5zvQezhaPqLyYKWvAgEK; Fri, 06 Mar 2026 16:47:12 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id yYKVvyxRnh8QWyYKWvZxUs; Fri, 06 Mar 2026 16:47:12 +0000 X-Authority-Analysis: v=2.4 cv=Mcdsu4/f c=1 sm=1 tr=0 ts=69ab0510 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=Yq5XynenixoA:10 a=ItBw4LHWJt0A:10 a=7CQSdrXTAAAA:8 a=IcdVleqpC5Bnia4FP6YA:9 a=a-qgeE7W1pNrGK8U0ZQC: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=qbVlyA4kQRjeKcn+yBv/+XPijt4rKep0VyDZGwcrwiY=; b=geoj3bblEzeTfg5d4f+Lu21Lvg zYj9vkseWy8dnNUaWdlsowc6kCUyGTbx0rH5Bz8R4rb27BXnug7ywf3IMr4dsWTAdntwe7p8zErmz +HDiu/zAr8cxeRJu7w91HZMIi; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:48954 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vyYKV-000000044Hh-2vMa; Fri, 06 Mar 2026 09:47:11 -0700 From: Tom Tromey To: Matthieu Longo Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH v2 5/9] gdb/python: allow ref_ptr::new_reference to accept subclasses of T In-Reply-To: (Matthieu Longo's message of "Fri, 6 Mar 2026 11:37:28 +0000") References: <20260303161659.397427-1-matthieu.longo@arm.com> <20260303161659.397427-6-matthieu.longo@arm.com> <87v7fcrd2x.fsf@tromey.com> X-Attribution: Tom Date: Fri, 06 Mar 2026 09:47:10 -0700 Message-ID: <871phwzz01.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: 1vyYKV-000000044Hh-2vMa X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:48954 X-Source-Auth: tom+tromey.com X-Email-Count: 12 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfF/lhbPM1/SvLKHoz+ZAwRfymKq/gCH0lXbuh0eWKU+jvtMmxogXXCrqOwenc6V5K3k4v6EAbW63zY48mwmQYILkMVR8AlGNu+//KjBHsFaX5dlf2MGC 9319OnIYB8S1W5hQURg+sX0lW7PJ8JzpzsCMtKNqVM1fZV9O+VVP/Fxrg4p0NX22uMFkrxLNvZThyXYSAZEjBy7VIWm8d0S9/mo= 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 Longo writes: > After a deeper examination, I am not sure that your series helps much for this patch. > * Case 1: return value from the registry. > PyObject *result = (PyObject *) cfpy_inferior_corefile_data_key.get (inf); > if (result != nullptr) > return gdbpy_ref<>::new_reference (result); > If I had gdbpy_borrowed_ref available, I could replace the code above by something like: > gdbpy_borrowed_ref result = cfpy_inferior_corefile_data_key.get (inf); > if (result != nullptr) > return result; /* assuming that gdbpy_ref<> would have a constructor taking gdbpy_borrowed_ref. */ Ok, I see. Sorry about that. Does the registry need to return a properly-typed one? Perhaps it can just always return a gdbpy_ref<>. > * Case 2: registration of the new object in the registry and return the value. > gdbpy_ref object > (PyObject_New (corefile_object, &corefile_object_type)); > ... > cfpy_inferior_corefile_data_key.set (inf, object.get ()); > return gdbpy_ref<>::new_reference (object.release ()); Here the release stuff is no longer needed as upcasting works fine: cfpy_inferior_corefile_data_key.set (...); return object; > However, I am getting further from my original objective, which was only flattening the code for upcoming changes. > All those improvements seem to me out of scope of my original patch. Yeah. It's fine to take small steps and not do too much. So if it's convenient just go ahead; but if you don't mind add a bit of explanation to the commit message. thanks, Tom