Revert "Performance improvement of 'python-shell-get-process'"

This reverts commit 83b4f1ba26.
We concluded that it is better to use 'project-name-cached'.
(Bug#80045)
This commit is contained in:
kobarity 2026-01-31 23:10:03 +09:00 committed by Eli Zaretskii
parent 419ac8148f
commit 3d7e78b810

View file

@ -3816,16 +3816,6 @@ variable.
(compilation-shell-minor-mode 1)
(python-pdbtrack-setup-tracking))
(defvar-local python-shell--process-cache)
(defvar-local python-shell--process-cache-valid)
(defun python-shell--invalidate-process-cache ()
"Invalidate process cache."
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(setq python-shell--process-cache nil
python-shell--process-cache-valid nil))))
(defun python-shell-make-comint (cmd proc-name &optional show internal)
"Create a Python shell comint buffer.
CMD is the Python command to be executed and PROC-NAME is the
@ -3842,7 +3832,6 @@ killed."
(let* ((proc-buffer-name
(format (if (not internal) "*%s*" " *%s*") proc-name)))
(when (not (comint-check-proc proc-buffer-name))
(python-shell--invalidate-process-cache)
(let* ((cmdlist (split-string-and-unquote cmd))
(interpreter (car cmdlist))
(args (cdr cmdlist))
@ -3966,15 +3955,7 @@ If current buffer is in `inferior-python-mode', return it."
(defun python-shell-get-process ()
"Return inferior Python process for current buffer."
(unless (and python-shell--process-cache-valid
(or (not python-shell--process-cache)
(and (process-live-p python-shell--process-cache)
(buffer-live-p
(process-buffer python-shell--process-cache)))))
(setq python-shell--process-cache
(get-buffer-process (python-shell-get-buffer))
python-shell--process-cache-valid t))
python-shell--process-cache)
(get-buffer-process (python-shell-get-buffer)))
(defun python-shell-get-process-or-error (&optional interactivep)
"Return inferior Python process for current buffer or signal error.