From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 7854E3857C45 for ; Fri, 24 Feb 2023 20:32:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7854E3857C45 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 31OKW0vZ017321 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Feb 2023 15:32:05 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 31OKW0vZ017321 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1677270725; bh=jo8QKbyEtUBbpT9UghKMpBCnxUhoT/jtBSNkph8WQgw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=F0PS9otDDBGJbF0ww92OT9ZoyxQGcljujn8fUxO/HDDgGCpQgZqUZxXlC4CdDDYBw HRhnqH4+BnM3dmjQprBjoSM+0pfaIWW5AGDh/P5+ggYne+vicg6kwpV8KO5XK8rHnV btfXr2p6Yh6cgV7gHvKel9MlkaM6wBCBMHPr3CKs= Received: from [10.255.0.64] (unknown [45.73.127.130]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6E3F21E128; Fri, 24 Feb 2023 15:32:00 -0500 (EST) Message-ID: <3a019b47-5dab-def1-807c-c8fbcf63872e@polymtl.ca> Date: Fri, 24 Feb 2023 15:31:59 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 3/9] gdb: gdbarch.py: spell out parameters of _Component.__init__ Content-Language: fr To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20230223221830.499934-1-simon.marchi@efficios.com> <20230223221830.499934-4-simon.marchi@efficios.com> <87bklihmf6.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87bklihmf6.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 24 Feb 2023 20:32:00 +0000 X-Spam-Status: No, score=-3031.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2/24/23 14:51, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> From: Simon Marchi > Simon> The way _Component uses kwargs is handy to save a few characters, but it > Simon> doesn't play well with static analysis. When editing gdbarch.py, my > Simon> editor (which uses pylance under the hood) knows nothing about the > Simon> properties of components. So it's full of squiggly lines, and typing > Simon> analysis (which I find really helpful) doesn't work. I therefore think > Simon> it would be better to spell out the parameters. > > Simon> @@ -87,7 +112,7 @@ class Value(_Component): > Simon> name, > Simon> type, > Simon> comment=None, > Simon> - predicate=None, > Simon> + predicate=False, > > This changes the type of predicate, which is fine, but there's still a > spot that does: > > # This little hack makes the generator a bit simpler. > self.predicate = None Huh, it's unfortunate that the type checker does not understand at this point that predicate (set in _Component.__init__ is a bool). It does understand it at other places. I don't understand why this assignment to None is there though. Wasn't predicate None by default anyway? Can we remove it, and in turn remove Info.__init__? If I do that, I see no diff in the generated files. Simon Simon