File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 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 functions"
46%
57% %% Inputs
68% * force_old: (optional) boolean flag to force checking of Python on Matlab < R2022a
1719 force_old = false ;
1820end
1921
20- persistent stdlib_py_version
22+ persistent stdlib_py_version pyv_cached
2123
2224msg = ' ' ;
2325
24- if ~isempty(stdlib_py_version )
26+ if isempty(pyv_cached )
27+ pyv_cached = false ;
28+ elseif pyv_cached
2529 v = stdlib_py_version ;
2630 return
2731end
4347 msg = e .message ;
4448end
4549
46- % cache the result
47- if ~isempty(v )
48- stdlib_py_version = v ;
49- end
50+ % cache the result - even if empty -- because the check takes up to 1000 ms say on HPC
51+ stdlib_py_version = v ;
52+ pyv_cached = true ;
5053
5154end
You can’t perform that action at this time.
0 commit comments