Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1492d7d

Browse files
committed
expose Min/MaxSupportedVersion and IsSupportedVersion on PythonEngine
fixes#1724
1 parent987b2ee commit1492d7d

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

‎CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ See [Mixins/collections.py](src/runtime/Mixins/collections.py).
2828
and other`PyObject` derived types when called from Python.
2929
- .NET classes, that have`__call__` method are callable from Python
3030
-`PyIterable` type, that wraps any iterable object in Python
31+
-`PythonEngine` properties for supported Python versions:`MinSupportedVersion`,`MaxSupportedVersion`, and`IsSupportedVersion`
3132

3233

3334
###Changed

‎src/runtime/PythonEngine.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ public static string PythonPath
127127
}
128128
}
129129

130+
publicstaticVersionMinSupportedVersion=>new(3,7);
131+
publicstaticVersionMaxSupportedVersion=>new(3,10,int.MaxValue,int.MaxValue);
132+
publicstaticboolIsSupportedVersion(Versionversion)=>version>=MinSupportedVersion&&version<=MaxSupportedVersion;
133+
130134
publicstaticstringVersion
131135
{
132136
get{returnMarshal.PtrToStringAnsi(Runtime.Py_GetVersion());}

‎tests/test_engine.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ def test_multiple_calls_to_initialize():
1919
assertFalse# Initialize() raise an exception.
2020

2121

22+
deftest_supported_version():
23+
major,minor,build,*_=sys.version_info
24+
ver=System.Version(major,minor,build)
25+
assertPythonEngine.IsSupportedVersion(ver)
26+
assertver>=PythonEngine.MinSupportedVersion
27+
assertver<=PythonEngine.MaxSupportedVersion
28+
29+
2230
@pytest.mark.skip(reason="FIXME: test crashes")
2331
deftest_import_module():
2432
"""Test module import."""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp