branch: elpa/flycheck
commit 891e11207fa7e3d8ec477436746c876084647a7f
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Verify python3 works instead of just checking it exists
On Windows, python3.exe may be a Microsoft Store stub that is
found by executable-find but is not a working interpreter. Use
call-process to verify the executable actually runs before
deciding whether to fall back to "python".
Ref #2062
---
flycheck.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/flycheck.el b/flycheck.el
index 6a97f7e8de..e9d665b796 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -10907,9 +10907,9 @@ See URL
`https://docs.python.org/3.4/library/py_compile.html'."
:modes (python-mode python-ts-mode)
:next-checkers ((warning . python-mypy)))
-;; On systems where "python3" is not available (e.g., Windows with
-;; Anaconda/Miniforge), fall back to "python" for Python-based checkers.
-(unless (executable-find "python3")
+;; On systems where "python3" is not a working interpreter (e.g., Windows
+;; where python3.exe is a Microsoft Store stub), fall back to "python".
+(unless (ignore-errors (zerop (call-process "python3" nil nil nil
"--version")))
(dolist (checker '(json-python-json python-flake8 python-pylint
python-pycompile))
(let ((var (flycheck-checker-executable-variable checker)))