all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Augusto Stoffel <arstoffel@gmail.com>, kobarity <kobarity@gmail.com>
Cc: 70440@debbugs.gnu.org
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Date: Wed, 17 Apr 2024 22:13:49 +0300	[thread overview]
Message-ID: <861q73hkeq.fsf@gnu.org> (raw)
In-Reply-To: <87h6fzj1b1.fsf@gmail.com> (message from Augusto Stoffel on Wed,  17 Apr 2024 20:23:30 +0200)

> From: Augusto Stoffel <arstoffel@gmail.com>
> 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 <arstoffel@gmail.com>
> 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?





  reply	other threads:[~2024-04-17 19:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 18:23 bug#70440: [PATCH] Use -P switch when calling 'python-interpreter' Augusto Stoffel
2024-04-17 19:13 ` Eli Zaretskii [this message]
2024-04-18 15:25   ` kobarity
2024-04-18 15:52     ` Augusto Stoffel
2024-04-18 15:57       ` Eli Zaretskii
2024-04-18 16:02         ` Augusto Stoffel
2024-04-18 16:13           ` Eli Zaretskii
2024-04-19  6:08     ` Augusto Stoffel
2024-04-19  7:15       ` Eli Zaretskii
2024-04-19 15:21         ` Augusto Stoffel
2024-04-19 15:40           ` Eli Zaretskii
2024-04-19 15:55             ` Augusto Stoffel
2024-04-19 17:31               ` Eli Zaretskii
2024-04-19 18:02                 ` Augusto Stoffel
2024-04-19 18:17                   ` Eli Zaretskii
2024-04-19 18:30                     ` Augusto Stoffel
2024-04-19 19:01                       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861q73hkeq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70440@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    --cc=kobarity@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.