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

Min/MaxSupportedVersion andIsSupportedVersion onPythonEngine#1799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
filmor merged 3 commits intomasterfromSupportedVersions
May 26, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,7 @@ See [Mixins/collections.py](src/runtime/Mixins/collections.py).
and other `PyObject` derived types when called from Python.
- .NET classes, that have `__call__` method are callable from Python
- `PyIterable` type, that wraps any iterable object in Python
- `PythonEngine` properties for supported Python versions: `MinSupportedVersion`, `MaxSupportedVersion`, and `IsSupportedVersion`


### Changed
Expand Down
4 changes: 4 additions & 0 deletionssrc/runtime/PythonEngine.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -127,6 +127,10 @@ public static string PythonPath
}
}

public static Version MinSupportedVersion => new(3, 7);
public static Version MaxSupportedVersion => new(3, 10, int.MaxValue, int.MaxValue);
public static bool IsSupportedVersion(Version version) => version >= MinSupportedVersion && version <= MaxSupportedVersion;

public static string Version
{
get { return Marshal.PtrToStringAnsi(Runtime.Py_GetVersion()); }
Expand Down
1 change: 1 addition & 0 deletionstests/test_codec.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@

@pytest.fixture(autouse=True)
def reset():
CodecResetter.Reset()
yield
CodecResetter.Reset()

Expand Down
4 changes: 3 additions & 1 deletiontests/test_conversion.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
import pytest

import System
from Python.Test import ConversionTest, MethodResolutionInt, UnicodeString
from Python.Test import ConversionTest, MethodResolutionInt, UnicodeString, CodecResetter
from Python.Runtime import PyObjectConversions
from Python.Runtime.Codecs import RawProxyEncoder

Expand DownExpand Up@@ -659,6 +659,8 @@ def CanEncode(self, clr_type):
l.Add(42)
assert ob.ListField.Count == 1

CodecResetter.Reset()

def test_int_param_resolution_required():
"""Test resolution of `int` parameters when resolution is needed"""

Expand Down
8 changes: 8 additions & 0 deletionstests/test_engine.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,14 @@ def test_multiple_calls_to_initialize():
assert False # Initialize() raise an exception.


def test_supported_version():
major, minor, build, *_ = sys.version_info
ver = System.Version(major, minor, build)
assert PythonEngine.IsSupportedVersion(ver)
assert ver >= PythonEngine.MinSupportedVersion
assert ver <= PythonEngine.MaxSupportedVersion


@pytest.mark.skip(reason="FIXME: test crashes")
def test_import_module():
"""Test module import."""
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp