From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter' Date: Wed, 17 Apr 2024 22:13:49 +0300 Message-ID: <861q73hkeq.fsf@gnu.org> References: <87h6fzj1b1.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19832"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70440@debbugs.gnu.org To: Augusto Stoffel , kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 17 21:15:22 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 1rxAka-0004wF-Im for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Apr 2024 21:15:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxAk6-0004Wc-84; Wed, 17 Apr 2024 15:14:50 -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 1rxAk4-0004UD-UM for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 15:14:48 -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 1rxAk4-0004Gv-MJ for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 15:14:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxAkH-0001Ad-NG for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 15:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Apr 2024 19:15:01 +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.17133812534116 (code B ref 70440); Wed, 17 Apr 2024 19:15:01 +0000 Original-Received: (at 70440) by debbugs.gnu.org; 17 Apr 2024 19:14:13 +0000 Original-Received: from localhost ([127.0.0.1]:47644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxAjV-00014K-8W for submit@debbugs.gnu.org; Wed, 17 Apr 2024 15:14:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxAjT-00013w-8Q for 70440@debbugs.gnu.org; Wed, 17 Apr 2024 15:14:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxAjA-00049d-RO; Wed, 17 Apr 2024 15:13:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=utEHf2Ajv1+ezhmTXjxjEix8qHx0/C5SqwOLAGocPkg=; b=XHDyvaZlr/64 BTWPuCV203Rc1KTaOwbH+4pHwWu7H3VorKzvETg4tjgn3pQ25TqOxJPngbhfiGj12pzz7+j/yTr91 6+nLmuK9Az+8K/O4/anAIUKPq+z3loGsV7wdx47ckm9ZeI52EV0jRS4rbr/eNf6TCwSLqBRUFiZcF C2hpopVLUuh2MV+Z5zBggTYaRevyd7LCRvp9qvxQWaGD8oYs49jlXpelSnltbPYjasoMBgNyULwj/ EFKZpkkXcLrS77XrRZ7xhOHdAYrFfJodbJXCx2KMNQgHxFhXDVZI1b+dVHYdhFr4DbykpPW2yrfxA 9YxC8L28Jsl9DWqUbcXAAg==; In-Reply-To: <87h6fzj1b1.fsf@gmail.com> (message from Augusto Stoffel on Wed, 17 Apr 2024 20:23:30 +0200) 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:283521 Archived-At: > 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?