From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ae0tJuH9oWlJ8wwAWB0awg (envelope-from ) for ; Fri, 27 Feb 2026 15:26:09 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=comcast.net header.i=@comcast.net header.a=rsa-sha256 header.s=20190202a header.b=RKLGcMS9; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 95BC11E0DD; Fri, 27 Feb 2026 15:26:09 -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.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 54D6D1E089 for ; Fri, 27 Feb 2026 15:26:08 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id E84234BA23CB for ; Fri, 27 Feb 2026 20:26:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E84234BA23CB Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=comcast.net header.i=@comcast.net header.a=rsa-sha256 header.s=20190202a header.b=RKLGcMS9 Received: from resqmta-a2p-640029.sys.comcast.net (resqmta-a2p-640029.sys.comcast.net [IPv6:2001:558:fd01:2bb4::b]) by sourceware.org (Postfix) with ESMTPS id 865B24BA23C9 for ; Fri, 27 Feb 2026 20:24:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 865B24BA23C9 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=comcast.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=comcast.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 865B24BA23C9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:558:fd01:2bb4::b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772223867; cv=none; b=Mr8suVhpyZlyHsoQD4jf/lzeW2DOaIzM1Z1nczEnVoaaKirRT4A9eNKNstAGv4ScpN22vH704j5Yozojo6T4Wa0WV4vcYRj1A2btPBGRLaMM+JzrLG48GnYJD6ZlWP/Zqy1x3yu9NIT2vqCIe7YR3xbOxW+kgHhfglgx1/Z1isA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772223867; c=relaxed/simple; bh=6gixy9lyiwNLnCoAXzeFVhbeolSG4wv/2wNVRyoPzFY=; h=DKIM-Signature:Mime-Version:Subject:From:Date:Message-Id:To; b=OOzCF8eRjwe80FyZCuy7HYCq0+2YWaqSXHriTiGYiLcNKXb3LmpBn7zDhnzqIufb4D6E7gvVoSzSJ/Q0YRgwl5OUTpTSsom1ccZSm4h5noQmIH3McdyggvhaK/shmzEK2J02VJZl8HnF+wILxvuRNUk4ysxtBvYh3QV6p4vv2Vg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 865B24BA23C9 Received: from resomta-a2p-647973.sys.comcast.net ([96.103.145.227]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 256/256 bits) (Client did not present a certificate) by resqmta-a2p-640029.sys.comcast.net with ESMTPS id vzJQvlfO7HoL5w4NrvGXKr; Fri, 27 Feb 2026 20:24:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1772223863; bh=6I57WvdwMl/RtUZ1er1kwKFNYJOOmkYSuBoWb6EoPAU=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To:Xfinity-Spam-Result; b=RKLGcMS9MRzy8nxmO86FYKfui23rNoLzhUdAgDp4VXmwzKEDU1TDui+MDx1MblUBG udDSHmMeZGPn9QsDoMCKl26pVDlX9G6sPiq+hg4e7qsr1Xvve4lEhzdgSsg2Mv851l s4yZHmDJnQsreNts+f0n5bcIns4C6jP2iDOWy/oc+Sm2PERJYBwzMnKQfYUq+yz5xS YA+lRtKY5g4oKyM9cjoHm954bHnJHG+b13ms7YBZyl7kXZJ45UiTe6U3tJRl2cNvym VgyHCn8DR0CqX2PJ+L8NCqGUFzDYpE19Lkt2+fHpSD1W+f8bIfRbXN7+wBIvWBrH8x lFN1xL80JqQmg== Received: from smtpclient.apple ([73.60.223.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 256/256 bits) (Client did not present a certificate) by resomta-a2p-647973.sys.comcast.net with ESMTPSA id w4NmvqMrYXDvuw4NnvTdtV; Fri, 27 Feb 2026 20:24:22 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.4\)) Subject: Re: [PATCH] Use the "O!" format more in the Python code From: Paul Koning In-Reply-To: <871pi6t0uw.fsf@tromey.com> Date: Fri, 27 Feb 2026 15:24:08 -0500 Cc: Tom de Vries , gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <78A812F6-2C9A-4E41-84BB-BA036D377BFD@comcast.net> References: <20260227164843.2275912-1-tom@tromey.com> <87qzq6t4vy.fsf@tromey.com> <283854B8-3788-43DB-991A-DEDF4CB56387@comcast.net> <871pi6t0uw.fsf@tromey.com> To: Tom Tromey X-Mailer: Apple Mail (2.3826.700.81.1.4) X-CMAE-Envelope: MS4xfJoe0e0+3gDYcr4r1VOD9zdMtd3BuxXihWekftItQMu5yBTU7RxtVWGqFYyHUcMMv1QLM6r2mI+mzXhyWmrpZHWcI82MO+iTakV8CMptihxNlq0HaHag kGcuNqe3h5q6JAGaPev5JiMmPi4Skl3Elhf3TbT733aJOi0D2QC4aHhBUAQYlTW/mrpy38zI8HQxLjpDIEgGV21zNNdDFgxROGYpDuoiJHPHYQIAk1Y8Uogv xb5RIOkU0MXiyeoi5u2brA== 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 > On Feb 27, 2026, at 2:58=E2=80=AFPM, Tom Tromey = wrote: >=20 >>>>>> "Paul" =3D=3D Paul Koning writes: >=20 > Paul> Also, any type can be subclassed. That > Paul> last point is not true for types defined in C code, unless the = code > Paul> allows it to happen. In general it should do so; it's very rare > Paul> indeed for it to be "the right thing" for a type not to allow > Paul> subclasses. >=20 > In gdb we've been fairly selective with this. >=20 > I looked it up and you have to set Py_TPFLAGS_BASETYPE, which we do in > 13 of the classes that gdb implements. >=20 > Maybe we should do this everywhere? But if we did that then wouldn't = we > also want to implement the 'dict' feature everywhere as well? You mean in the sense that an object acts as if it has a dictionary = inside, holding its attributes? I'm not sure if that is needed for the = GDB (base) classes. Consider "slotted" objects, which don't have one, = but can be subclassed and the subclass objects may have a dictionary, or = not, at the discretion of the subclass author. > I'm not sure there's a big advantage to it or need for it though. > So maybe it's just busy-work. >=20 > I've been hoping to transition the internal types to be real C++ = types, > like give them constructors and destructors, initializers, etc. But > maybe it's not really possible with the Python lifetime model, at = least > when subclassing is available. Python classes have construtors and destructors, but they work = differently than C++. Especially destructors because it isn't = necessarily obvious when they will be called, at least for some = scenarios where things aren't freed until the garbage collector gets = there. It's indeed possible that for some classes subclassing is unlikely to be = wanted. But I do remember, some years ago, wanting to subclass a GDB = type and finding I could not. I no longer remember which class it was, = unfortunately. paul=