From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uHEiNkib22Ic/RgAWB0awg (envelope-from ) for ; Sat, 23 Jul 2022 02:55:04 -0400 Received: by simark.ca (Postfix, from userid 112) id DA1941E5EA; Sat, 23 Jul 2022 02:55:04 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=cpC+fbhU; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 ESMTPS id 7D5451E222 for ; Sat, 23 Jul 2022 02:55:04 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F0AA3857C69 for ; Sat, 23 Jul 2022 06:55:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F0AA3857C69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1658559304; bh=UFj5/Saa1UhQ/piM4/kTppLTiixTaxBZWtUgZx3R21E=; h=Date:To:In-Reply-To:Subject:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=cpC+fbhUw7xklmOP0YbA/3xqXZwUaJ2suWiZnhkCo3PRcXu7t2pCkx8R28QR+qdto 0iwFS/C/mbg+gsAZhZchK08ckcCy+N58iQgumHArJWjChFAQLAVBY28UJjFDit17jE 8K6tln3M7JrlQMc5Ij09zqHJh6pmo/1ae2mMXlxw= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id ECEC03858C50 for ; Sat, 23 Jul 2022 06:54:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ECEC03858C50 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oF92A-0002aS-Kf; Sat, 23 Jul 2022 02:54:42 -0400 Received: from [87.69.77.57] (port=4778 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oF923-0002Kt-SM; Sat, 23 Jul 2022 02:54:38 -0400 Date: Sat, 23 Jul 2022 09:54:33 +0300 Message-Id: <83y1wkiaja.fsf@gnu.org> To: Kevin Buettner In-Reply-To: <20220722183722.57d34c34@f35-zws-1> (message from Kevin Buettner on Fri, 22 Jul 2022 18:37:22 -0700) Subject: Re: [PATCH] set/show python dont-write-bytecode fixes References: <20220720191447.1014407-1-kevinb@redhat.com> <96a7e665-5700-349c-dfc5-50e59ab78fa5@palves.net> <20220721160832.3a1d4b3c@f35-zws-1> <83v8rplkfs.fsf@gnu.org> <20220722183722.57d34c34@f35-zws-1> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Eli Zaretskii via Gdb-patches Reply-To: Eli Zaretskii Cc: simark@simark.ca, pedro@palves.net, gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > Date: Fri, 22 Jul 2022 18:37:22 -0700 > From: Kevin Buettner > Cc: gdb-patches@sourceware.org, pedro@palves.net, simark@simark.ca > > > > +In order to take effect, this setting must be enabled before python\n\ > > > +initialization."), > > > > Will GDB users understand clearly what that means in practical terms? > > The GDB manual contains similar (though not identical) wording. I > referenced the manual while writing the help text. However, the > manual does contain additional explanation to help the reader > understand how to use the command so that it will actually take > effect. > > > Should we say instead "before invoking the Python interpreter for the > > first time"? > > We could, but I don't think that your suggested wording is accurate. > > My understanding of things is that in order to effectively use 'set > python dont-write-bytecode', it must be placed in an early > initialization file, i.e. those run via the --early-init-eval-command > or -eix options. If the command were placed in some other > initialization file, it might well be run before the embedded Python > interpreter is run for the first time, yet still not take effect due > to the command being executed after Python initialization. > > Another way to make sure that the command takes effect is to > use one of the following options on the GDB command line: > > --early-init-eval-command 'set python dont-write-bytecode on' > > or: > > -eiex 'set python dont-write-bytecode on' Maybe we should say in the doc string that these are the only ways of changing this setting so it has effect? > > Finally should we mention the PYTHONDONTWRITEBYTECODE environment > > variable? > > It is already documented in the GDB manual. Should it also be > mentioned in the help text? That was my question. > Another fly in the ointment is that the 'python ignore-environment' > setting also affects how dont-write-bytecode behaves when it's set to > 'auto'. If ignore-environment is 'on', then PYTHONDONTWRITEBYTECODE > is ignored. > > This seems like a lot of detail to place in the help text. Maybe we should try saying all that, and then decide whether the resulting text is too long? > I just noticed that, regarding the "auto" setting, the GDB manual says > "... in this mode Python will check the environment variable > PYTHONDONTWRITEBYTECODE to see if it should write out byte-code or > not." What it doesn't say is what settings the environment variable > must have in order to cause byte-code compilation to be suppressed. > It turns out that any value other than non-existence or the > empty string will enable the supression of byte-code compilation. > I.e. using "PYTHONDONTWRITEBYTECODE=no" might not do what the user > expects. So, it seems to me that we might update the manual to > make this clear. (I can include that in the v2 patch if you agree.) I agree. Thanks.