Message ID | 20230223221830.499934-1-simon.marchi@efficios.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 70295385B508 for <patchwork@sourceware.org>; Thu, 23 Feb 2023 22:19:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70295385B508 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677190742; bh=qEK4YDugFAuaym/GccLuFtk0tg5V+/Khuk5SWrhZVMY=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=jy6ORaIsuKUl2Hyq5JvKOk23xQYMS57xrURz/7WgTwz0F+BDa9byQIyqtIdCBiQdI FoJAYC/aWhClHps6ikqiHdzqKRutcrIt+xioEI1rBZ0zx/NLSAQQaiO0gklTUG+2Z7 hYx3ubWIVOsMn18o+SiY59E5ZddAFKS84A0U8Ftg= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 3E09B3858C00 for <gdb-patches@sourceware.org>; Thu, 23 Feb 2023 22:18:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3E09B3858C00 Received: from smarchi-efficios.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 787D81E0D3; Thu, 23 Feb 2023 17:18:31 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi <simon.marchi@efficios.com> Subject: [PATCH 0/9] Add typing annotations to gdbarch*.py and make-target-delegates.py Date: Thu, 23 Feb 2023 17:18:21 -0500 Message-Id: <20230223221830.499934-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3491.6 required=5.0 tests=BAYES_00, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Simon Marchi <simon.marchi@efficios.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Add typing annotations to gdbarch*.py and make-target-delegates.py
|
|
Message
Simon Marchi
Feb. 23, 2023, 10:18 p.m. UTC
While investigating something related to a gdbarch method, I was trying to understand the purpose of the "invalid" Function parameter. It is sometimes passed a boolean and sometimes passed a string. This is indeed described in the comment at the top of gdbarch-components.py, but I then thought that if we used type annotations, it would make it clear that it's intended. Also, I find type annotations (when paired with a checker such as pyright or pylance) really handy to avoid all kinds of mistake. So I got a bit carried away, and this series is the result. Simon Marchi (9): gdb: remove invalid / dead code from gdbarch.py gdb: reformat Python files with black 23.1.0 gdb: gdbarch.py: spell out parameters of _Component.__init__ gdb: pyproject.toml: set pyright typeCheckingMode = "strict" gdb: split gdbarch component types to gdbarch_types.py gdb: gdbarch*.py, copyright.py: add type annotations gdb: make-target-delegates.py: make one string raw gdb: make-target-delegates.py: add Entry type gdb: make-target-delegates.py: add type annotations gdb/gdbarch.py | 161 +-------------- ...ch-components.py => gdbarch_components.py} | 8 +- gdb/gdbarch_types.py | 189 ++++++++++++++++++ gdb/gdbcopyright.py | 2 +- gdb/make-target-delegates.py | 104 +++++++--- gdb/pyproject.toml | 3 + gdb/python/lib/gdb/FrameDecorator.py | 1 - gdb/python/lib/gdb/command/frame_filters.py | 1 + gdb/python/lib/gdb/dap/server.py | 2 +- gdb/python/lib/gdb/printing.py | 2 +- .../gdb.multi/multi-target-info-inferiors.py | 1 + gdb/testsuite/gdb.perf/backtrace.py | 1 - .../gdb.python/py-framefilter-addr.py | 1 + gdb/testsuite/gdb.python/py-framefilter.py | 1 + gdb/testsuite/gdb.python/py-inferior-leak.py | 2 + gdb/testsuite/gdb.python/py-prettyprint.py | 1 + gdb/testsuite/gdb.python/py-recurse-unwind.py | 5 - gdb/testsuite/gdb.python/py-send-packet.py | 1 + gdb/testsuite/gdb.python/tui-window.py | 1 + 19 files changed, 290 insertions(+), 197 deletions(-) rename gdb/{gdbarch-components.py => gdbarch_components.py} (99%) create mode 100755 gdb/gdbarch_types.py
Comments
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes: Simon> While investigating something related to a gdbarch method, I was trying Simon> to understand the purpose of the "invalid" Function parameter. It is Simon> sometimes passed a boolean and sometimes passed a string. This is Simon> indeed described in the comment at the top of gdbarch-components.py, but Simon> I then thought that if we used type annotations, it would make it clear Simon> that it's intended. Also, I find type annotations (when paired with a Simon> checker such as pyright or pylance) really handy to avoid all kinds of Simon> mistake. So I got a bit carried away, and this series is the result. This all seems fine to me, though I found one it. Reviewed-By: Tom Tromey <tom@tromey.com> Tom