Skip to content

Commit 6b65e9c

Browse files
committed
stdlib.python_version: cache no python too
This is important for HPC or any computer without Python, to not waste time rechecking
1 parent afc951d commit 6b65e9c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

+stdlib/python_version.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
%% PYTHON_VERSION get the Python version used by MATLAB
22
%
3-
% uses persistent variable to cache the Python version
3+
% uses persistent variable to cache the Python version.
4+
% If the environment changes, the cached version will be invalid.
5+
% this cache is cleared by "clear stdlib.python_version"
46
%
57
%%% Inputs
68
% * force_old: (optional) boolean flag to force checking of Python on Matlab < R2022a
@@ -43,9 +45,7 @@
4345
msg = e.message;
4446
end
4547

46-
% cache the result
47-
if ~isempty(v)
48-
stdlib_py_version = v;
49-
end
48+
% cache the result - even if empty -- because the check takes up to 1000 ms say on HPC
49+
stdlib_py_version = v;
5050

5151
end

0 commit comments

Comments
 (0)