@@ -12,47 +12,124 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
12
12
- Ability to instantiate new .NET arrays using ` Array[T](dim1, dim2, ...) ` syntax
13
13
- Python operator method will call C# operator method for supported binary and unary operators ([ #1324 ] [ p1324 ] ).
14
14
- Add GetPythonThreadID and Interrupt methods in PythonEngine
15
+ - Ability to implement delegates with ` ref ` and ` out ` parameters in Python, by returning the modified parameter values in a tuple. ([ #1355 ] [ i1355 ] )
16
+ - Ability to override .NET methods that have ` out ` or ` ref ` in Python by returning the modified parameter values in a tuple. ([ #1481 ] [ i1481 ] )
17
+ - ` PyType ` - a wrapper for Python type objects, that also permits creating new heap types from ` TypeSpec `
18
+ - Improved exception handling:
19
+ * exceptions can now be converted with codecs
20
+ * ` InnerException ` and ` __cause__ ` are propagated properly
21
+ - ` __name__ ` and ` __signature__ ` to reflected .NET methods
22
+ - .NET collection types now implement standard Python collection interfaces from ` collections.abc ` .
23
+ See [ Mixins/collections.py] ( src/runtime/Mixins/collections.py ) .
24
+ - you can cast objects to generic .NET interfaces without specifying generic arguments as long as there is no ambiguity.
25
+ - .NET arrays implement Python buffer protocol
26
+ - Python integer interoperability with ` System.Numerics.BigInteger `
27
+ - Python.NET will correctly resolve .NET methods, that accept ` PyList ` , ` PyInt ` ,
28
+ and other ` PyObject ` derived types when called from Python.
29
+ - .NET classes, that have ` __call__ ` method are callable from Python
30
+ - ` PyIterable ` type, that wraps any iterable object in Python
31
+ - ` PythonEngine ` properties for supported Python versions: ` MinSupportedVersion ` , ` MaxSupportedVersion ` , and ` IsSupportedVersion `
32
+ - The runtime that is loaded on ` import clr ` can now be configured via environment variables
33
+
15
34
16
35
### Changed
17
- - Drop support for Python 2, 3.4, and 3.5
36
+ - Drop support for Python 2, 3.4, 3.5, and 3.6
18
37
- ` wchar_t ` size aka ` Runtime.UCS ` is now determined at runtime
19
38
- ` clr.AddReference ` may now throw errors besides ` FileNotFoundException ` , that provide more
20
39
details about the cause of the failure
21
40
- ` clr.AddReference ` no longer adds ".dll" implicitly
22
41
- ` PyIter(PyObject) ` constructor replaced with static ` PyIter.GetIter(PyObject) ` method
42
+ - Python runtime can no longer be shut down if the Python error indicator is set, as it would have unpredictable behavior
23
43
- BREAKING: Return values from .NET methods that return an interface are now automatically
24
44
wrapped in that interface. This is a breaking change for users that rely on being
25
45
able to access members that are part of the implementation class, but not the
26
- interface. Use the new __ implementation__ or __ raw_implementation__ properties to
46
+ interface. Use the new ` __implementation__ ` or ` __raw_implementation__ ` properties to
27
47
if you need to "downcast" to the implementation class.
48
+ - BREAKING: ` == ` and ` != ` operators on ` PyObject ` instances now use Python comparison
49
+ (previously was equivalent to ` object.ReferenceEquals(,) ` )
28
50
- BREAKING: Parameters marked with ` ParameterAttributes.Out ` are no longer returned in addition
29
51
to the regular method return value (unless they are passed with ` ref ` or ` out ` keyword).
30
52
- BREAKING: Drop support for the long-deprecated CLR.* prefix.
31
53
- ` PyObject ` now implements ` IEnumerable<PyObject> ` in addition to ` IEnumerable `
32
54
- floating point values passed from Python are no longer silently truncated
33
55
when .NET expects an integer [ #1342 ] [ i1342 ]
56
+ - More specific error messages for method argument mismatch
57
+ - members of ` PyObject ` inherited from ` System.Object and ` DynamicObject` now autoacquire GIL
58
+ - BREAKING: when inheriting from .NET types in Python if you override ` __init__ ` you
59
+ must explicitly call base constructor using ` super().__init__(.....) ` . Not doing so will lead
60
+ to undefined behavior.
61
+ - BREAKING: most ` PyScope ` methods will never return ` null ` . Instead, ` PyObject ` ` None ` will be returned.
62
+ - BREAKING: ` PyScope ` was renamed to ` PyModule `
63
+ - BREAKING: Methods with ` ref ` or ` out ` parameters and void return type return a tuple of only the ` ref ` and ` out ` parameters.
64
+ - BREAKING: to call Python from .NET ` Runtime.PythonDLL ` property must be set to Python DLL name
65
+ or the DLL must be loaded in advance. This must be done before calling any other Python.NET functions.
66
+ - BREAKING: ` PyObject.Length() ` now raises a ` PythonException ` when object does not support a concept of length.
67
+ - BREAKING: disabled implicit conversion from C# enums to Python ` int ` and back.
68
+ One must now either use enum members (e.g. ` MyEnum.Option ` ), or use enum constructor
69
+ (e.g. ` MyEnum(42) ` or ` MyEnum(42, True) ` when ` MyEnum ` does not have a member with value 42).
70
+ - Sign Runtime DLL with a strong name
71
+ - Implement loading through ` clr_loader ` instead of the included ` ClrModule ` , enables
72
+ support for .NET Core
73
+ - BREAKING: .NET and Python exceptions are preserved when crossing Python/.NET boundary
74
+ - BREAKING: custom encoders are no longer called for instances of ` System.Type `
75
+ - ` PythonException.Restore ` no longer clears ` PythonException ` instance.
76
+ - Replaced the old ` __import__ ` hook hack with a PEP302-style Meta Path Loader
77
+ - BREAKING: Names of .NET types (e.g. ` str(__class__) ` ) changed to better support generic types
78
+ - BREAKING: overload resolution will no longer prefer basic types. Instead, first matching overload will
79
+ be chosen.
80
+ - BREAKING: acquiring GIL using ` Py.GIL ` no longer forces ` PythonEngine ` to initialize
81
+ - BREAKING: ` Exec ` and ` Eval ` from ` PythonEngine ` no longer accept raw pointers.
82
+ - BREAKING: .NET collections and arrays are no longer automatically converted to
83
+ Python collections. Instead, they implement standard Python
84
+ collection interfaces from ` collections.abc ` .
85
+ See [ Mixins/collections.py] ( src/runtime/Mixins/collections.py ) .
86
+ - BREAKING: When trying to convert Python ` int ` to ` System.Object ` , result will
87
+ be of type ` PyInt ` instead of ` System.Int32 ` due to possible loss of information.
88
+ Python ` float ` will continue to be converted to ` System.Double ` .
89
+ - BREAKING: Python.NET will no longer implicitly convert types like ` numpy.float64 ` , that implement ` __float__ ` to
90
+ ` System.Single ` and ` System.Double ` . An explicit conversion is required on Python or .NET side.
91
+ - BREAKING: ` PyObject.GetHashCode ` can fail.
92
+ - BREAKING: Python.NET will no longer implicitly convert any Python object to ` System.Boolean ` .
93
+ - BREAKING: ` PyObject.GetAttr(name, default) ` now only ignores ` AttributeError ` (previously ignored all exceptions).
94
+ - BREAKING: ` PyObject ` no longer implements ` IEnumerable<PyObject> ` .
95
+ Instead, ` PyIterable ` does that.
96
+ - BREAKING: ` IPyObjectDecoder.CanDecode ` ` objectType ` parameter type changed from ` PyObject ` to ` PyType `
34
97
35
98
### Fixed
36
99
37
- - Fix incorrect dereference of wrapper object in ` tp_repr ` , which may result in a program crash
38
- - Fix incorrect dereference in params array handling
39
- - Fixes issue with function resolution when calling overloaded function with keyword arguments from python ([ #1097 ] [ i1097 ] )
40
- - Fix ` object[] ` parameters taking precedence when should not in overload resolution
41
- - Fixed a bug where all .NET class instances were considered Iterable
42
- - Fix incorrect choice of method to invoke when using keyword arguments.
43
- - Fix non-delegate types incorrectly appearing as callable.
44
- - Indexers can now be used with interface objects
45
- - Fixed a bug where indexers could not be used if they were inherited
46
- - Made it possible to use ` __len__ ` also on ` ICollection<> ` interface objects
47
- - Fixed issue when calling PythonException.Format where another exception would be raise for unnormalized exceptions
48
- - Made it possible to call ` ToString ` , ` GetHashCode ` , and ` GetType ` on inteface objects
49
- - Fixed objects returned by enumerating ` PyObject ` being disposed too soon
50
- - Incorrectly using a non-generic type with type parameters now produces a helpful Python error instead of throwing NullReferenceException
100
+ - Fix incorrect dereference of wrapper object in ` tp_repr ` , which may result in a program crash
101
+ - Fixed parameterless .NET constructor being silently called when a matching constructor overload is not found ([ #238 ] [ i238 ] )
102
+ - Fix incorrect dereference in params array handling
103
+ - Fixes issue with function resolution when calling overloaded function with keyword arguments from python ([ #1097 ] [ i1097 ] )
104
+ - Fix ` object[] ` parameters taking precedence when should not in overload resolution
105
+ - Fixed a bug where all .NET class instances were considered Iterable
106
+ - Fix incorrect choice of method to invoke when using keyword arguments.
107
+ - Fix non-delegate types incorrectly appearing as callable.
108
+ - Indexers can now be used with interface objects
109
+ - Fixed a bug where indexers could not be used if they were inherited
110
+ - Made it possible to use ` __len__ ` also on ` ICollection<> ` interface objects
111
+ - Fixed issue when calling PythonException.Format where another exception would be raise for unnormalized exceptions
112
+ - Made it possible to call ` ToString ` , ` GetHashCode ` , and ` GetType ` on inteface objects
113
+ - Fixed objects returned by enumerating ` PyObject ` being disposed too soon
114
+ - Incorrectly using a non-generic type with type parameters now produces a helpful Python error instead of throwing NullReferenceException
51
115
- ` import ` may now raise errors with more detail than "No module named X"
116
+ - Exception stacktraces on ` PythonException.StackTrace ` are now properly formatted
117
+ - Providing an invalid type parameter to a generic type or method produces a helpful Python error
118
+ - Empty parameter names (as can be generated from F#) do not cause crashes
119
+ - Unicode strings with surrogates were truncated when converting from Python
120
+ - ` Reload ` mode now supports generic methods (previously Python would stop seeing them after reload)
121
+ - Temporarily fixed issue resolving method overload when method signature has ` out ` parameters ([ #1672 ] ( i1672 ) )
122
+ - Decimal default parameters are now correctly taken into account
52
123
53
124
### Removed
54
125
126
+ - ` ShutdownMode ` has been removed. The only shutdown mode supported now is an equivalent of ` ShutdownMode.Reload ` .
127
+ There is no need to specify it.
55
128
- implicit assembly loading (you have to explicitly ` clr.AddReference ` before doing import)
129
+ - messages in ` PythonException ` no longer start with exception type
130
+ - ` PyScopeManager ` , ` PyScopeException ` , ` PyScope ` (use ` PyModule ` instead)
131
+ - support for .NET Framework 4.0-4.6; Mono before 5.4. Python.NET now requires .NET Standard 2.0
132
+ (see [ the matrix] ( https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support ) )
56
133
57
134
## [ 2.5.0] [ ] - 2020-06-14
58
135
@@ -813,3 +890,6 @@ This version improves performance on benchmarks significantly compared to 2.3.
813
890
[ p534 ] : https://github.com/pythonnet/pythonnet/pull/534
814
891
[ i449 ] : https://github.com/pythonnet/pythonnet/issues/449
815
892
[ i1342 ] : https://github.com/pythonnet/pythonnet/issues/1342
893
+ [ i238 ] : https://github.com/pythonnet/pythonnet/issues/238
894
+ [ i1481 ] : https://github.com/pythonnet/pythonnet/issues/1481
895
+ [ i1672 ] : https://github.com/pythonnet/pythonnet/pull/1672
0 commit comments