From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id EF92E3858CDA for ; Wed, 20 Jul 2022 19:20:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EF92E3858CDA Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-88-U724cGxjNG-4_veJdlj9VA-1; Wed, 20 Jul 2022 15:19:56 -0400 X-MC-Unique: U724cGxjNG-4_veJdlj9VA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3921418A6523; Wed, 20 Jul 2022 19:19:56 +0000 (UTC) Received: from f35-zws-1 (unknown [10.2.16.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3A5290A04; Wed, 20 Jul 2022 19:19:55 +0000 (UTC) Date: Wed, 20 Jul 2022 12:19:54 -0700 From: Kevin Buettner To: Simon Marchi Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [PATCH v3] Handle Python 3.11 deprecation of PySys_SetPath and Py_SetProgramName Message-ID: <20220720121954.5997f802@f35-zws-1> In-Reply-To: <5013d7ce-5e1e-ade9-d41f-32a15e1a5de8@simark.ca> References: <20220715215814.246906-1-kevinb@redhat.com> <5013d7ce-5e1e-ade9-d41f-32a15e1a5de8@simark.ca> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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 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: , X-List-Received-Date: Wed, 20 Jul 2022 19:20:05 -0000 On Mon, 18 Jul 2022 11:49:48 -0400 Simon Marchi wrote: > > @@ -1849,6 +1855,24 @@ show_python_dont_write_bytecode (struct ui_file *file, int from_tty, > > value); > > } > > > > +/* Return value to assign to PyConfig.write_bytecode or, when > > + negated (via !), Py_DontWriteBytecodeFlag. Py_DontWriteBytecodeFlag > > + is deprecated in Python 3.12. */ > > + > > +static int > > +python_write_bytecode () > > +{ > > + int wbc = 0; > > + > > + if (python_dont_write_bytecode == AUTO_BOOLEAN_AUTO) > > + wbc = (!python_ignore_environment > > + && getenv ("PYTHONDONTWRITEBYTECODE") != nullptr) ? 0 : 1; > > I think it predates your patch (so, orthogonal), but the Python doc says: > > If this is set to a non-empty string, Python won't try to write .pyc > files on the import of source modules. > > So I think we would need a "non-empty string" check here? I agree. I've pushed the v3 deprecation patch and have posted a new/separate patch which fixes the problem you spotted. It also fixes the set/show python dont-write-bytecode command documentation. See: https://sourceware.org/pipermail/gdb-patches/2022-July/190912.html Kevin