Skip to content

Commit 7c9dfbd

Browse files
committed
conslidate
1 parent a00baf6 commit 7c9dfbd

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

+stdlib/+python/version.m

Lines changed: 0 additions & 23 deletions
This file was deleted.

+stdlib/python_version.m

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,20 @@
2424
return
2525
end
2626

27-
% we use a separate function because the JIT compiler in Matlab < R2022a
28-
% breaks for any py.* command when pyenv() is not correctly configured
27+
% Matlab < R2022a has a bug in the JIT compiler that breaks try-catch
28+
% for any py.* command.
29+
% We use a separate private function to workaround that.
2930

30-
v = stdlib.python.version(force_old);
31+
v = [];
32+
33+
if isMATLABReleaseOlderThan('R2022a') && ~force_old
34+
return
35+
end
36+
37+
% need to have no catch section as glitchy Python load can make TypeError etc.
38+
try %#ok<TRYNC>
39+
v = pvt_python_version();
40+
end
3141

3242
% cache the result
3343
if ~isempty(v)

0 commit comments

Comments
 (0)