From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: kobarity Newsgroups: gmane.emacs.bugs Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter' Date: Fri, 19 Apr 2024 00:25:46 +0900 Message-ID: References: <87h6fzj1b1.fsf@gmail.com> <861q73hkeq.fsf@gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11574"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 70440@debbugs.gnu.org To: Augusto Stoffel , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 18 17:27:10 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rxTfK-0002kB-3t for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Apr 2024 17:27:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxTf1-0000IM-VN; Thu, 18 Apr 2024 11:26:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxTf0-0000I7-A2 for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 11:26:50 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rxTf0-0006G1-1c for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 11:26:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxTfD-0007lW-9k for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 11:27:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Apr 2024 15:27:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70440 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70440-submit@debbugs.gnu.org id=B70440.171345400429669 (code B ref 70440); Thu, 18 Apr 2024 15:27:03 +0000 Original-Received: (at 70440) by debbugs.gnu.org; 18 Apr 2024 15:26:44 +0000 Original-Received: from localhost ([127.0.0.1]:53030 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxTet-0007iT-4i for submit@debbugs.gnu.org; Thu, 18 Apr 2024 11:26:43 -0400 Original-Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:52439) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxTeq-0007hc-LU for 70440@debbugs.gnu.org; Thu, 18 Apr 2024 11:26:41 -0400 Original-Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6ed054f282aso906768b3a.0 for <70440@debbugs.gnu.org>; Thu, 18 Apr 2024 08:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713453981; x=1714058781; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=fQPV5YwkqxQCplC3b2R/AGfe9IP0waz5ptaCzJs46VM=; b=CNQHYsIR7w0QXH1TQWjmadt8DevWhLxqk7i77BZiNwTYs8A0NX9uWB1bpl/42APuBB 4qwdZ8Q4o4LiOlpajXaZyB/sFWohzOdZiPWI/JgRID7e7Wu3rS+RuBXeWJR5MBg9PHNN +qgS0AEUakVft5TLmzDbqAN8p32n7SlzG/Tak4ftToalJD6DhZTJlU09BO5VBemPVZ2m Pg6K4qD6CB/RLxWjLVwgndt7f44al3RNvzfF0Frzda2V0VJ6LO9s7SOBeVNKCwjoQyyx 2dKWvVy1Tc571fKeWo7hLPqEG4pIPzC1ZfQ+K5npl/E0j1rk0t7oUnA2gxr6V8ez5h0V twEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713453981; x=1714058781; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fQPV5YwkqxQCplC3b2R/AGfe9IP0waz5ptaCzJs46VM=; b=pqrwHxJE0xHUGMJ2ld9MlBlMtWiebzNfz56/K9wSaBS5XqCsn/Ak1fNZtjGPhY4GSn S+0cGwnduLZs2EcrVferrOIsB95IwxpG2xF7mIA+k0/Lr1Whn1dRbN2gTZkiMYK0ZHiW XuLySVv6m8hIhfG9r+f9iPRvVwAf93WeSY+hyUyzOQWOT2G6sFQ+ieGCyZctadouwyJ0 5KenfjzEdXn5wEuHjYDEBU7X0sFVXgrZCnp7l5w6FpxApuUs7OHbZQoDf8JPrMe2uDzk 5MBtCdcJe7KuPAPgmewuVpI4VhY2QbMEIMCADZukjgSyNipuTBHZ8koEygWt8wxAkLX2 UxEg== X-Gm-Message-State: AOJu0YyYqobMwtC2MfIr7XBeiu0P0zfyQUfNVAzwP2mVKgpFHqnTvcV0 UzvP1VtuEvhAyfbn4i+wRZo8MDCRmByiXicuOivzAovRpI/zXsYp X-Google-Smtp-Source: AGHT+IHfI7qyPVs6EuoCm7oxGwTdHWFMzsJ3Cw66aznRcYTIUgL84ru9MhLlzI/x3N45VDDiLt+qkA== X-Received: by 2002:a05:6a21:3e01:b0:1aa:8442:21ba with SMTP id bk1-20020a056a213e0100b001aa844221bamr3509248pzc.21.1713453981173; Thu, 18 Apr 2024 08:26:21 -0700 (PDT) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id h15-20020a170902680f00b001e89e7b2b74sm850061plk.235.2024.04.18.08.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 08:26:20 -0700 (PDT) In-Reply-To: <861q73hkeq.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283572 Archived-At: Eli Zaretskii wrote: > > From: Augusto Stoffel > > Date: Wed, 17 Apr 2024 20:23:30 +0200 > > > > The attachment should be self-explanatory, otherwise let me know. > > > > > > >From 04db8a3fbb29f497fdc728f4413aea162650b30b Mon Sep 17 00:00:00 2001 > > From: Augusto Stoffel > > Date: Wed, 17 Apr 2024 20:17:22 +0200 > > Subject: [PATCH] Use -P switch when calling 'python-interpreter' > > > > This excludes the current directory from Python's module load path, > > which can be unsafe. > > > > * lisp/progmodes/python.el (python--list-imports): Use -P switch > > (python--do-isort): Use -P switch > > (python-fix-imports): Use -P switch > > --- > > lisp/progmodes/python.el | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el > > index 85279d3e84b..180a8357aad 100644 > > --- a/lisp/progmodes/python.el > > +++ b/lisp/progmodes/python.el > > @@ -6805,7 +6805,7 @@ python--list-imports > > (append > > (split-string-shell-command > > python-interpreter-args) > > - `("-c" ,python--list-imports) > > + `("-Pc" ,python--list-imports) > > (list (or name ""))))) > > (with-current-buffer buffer > > (apply #'call-process > > @@ -6814,7 +6814,7 @@ python--list-imports > > (append > > (split-string-shell-command > > python-interpreter-args) > > - `("-c" ,python--list-imports) > > + `("-Pc" ,python--list-imports) > > (list (or name "")) > > (mapcar #'file-local-name source)))))) > > lines) > > @@ -6862,7 +6862,7 @@ python--do-isort > > (append > > (split-string-shell-command > > python-interpreter-args) > > - '("-m" "isort" "-") > > + '("-Pm" "isort" "-") > > args))) > > (tick (buffer-chars-modified-tick))) > > (unless (eq 0 status) > > @@ -6940,7 +6940,7 @@ python-fix-imports > > (append > > (split-string-shell-command > > python-interpreter-args) > > - '("-m" "pyflakes")))) > > + '("-Pm" "pyflakes")))) > > (goto-char (point-min)) > > (when (looking-at-p ".* No module named pyflakes$") > > (error "%s couldn't find pyflakes" python-interpreter)) > > -- > > 2.44.0 > > > > Thanks. > > kobarity, any comments? The -P switch is new, introduced in CPython 3.11, so I don't think it can be added unconditionally. Furthermore, `python-interpreter' may not be CPython. Isn't it enough to customize `python-interpreter-args'?