| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,8 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. | |||
| 20 | 20 | - .NET collection types now implement standard Python collection interfaces from `collections.abc`. | |
| 21 | 21 | See [Mixins/collections.py](src/runtime/Mixins/collections.py). | |
| 22 | 22 | - .NET arrays implement Python buffer protocol | |
| 23 | + - Python.NET will correctly resolve .NET methods, that accept `PyList`, `PyInt`, | ||
| 24 | + and other `PyObject` derived types when called from Python. | ||
| 23 | 25 | ||
| 24 | 26 | ||
| 25 | 27 | ### Changed | |
@@ -51,13 +53,20 @@ One must now either use enum members (e.g. `MyEnum.Option`), or use enum constru | |||
| 51 | 53 | - Sign Runtime DLL with a strong name | |
| 52 | 54 | - Implement loading through `clr_loader` instead of the included `ClrModule`, enables | |
| 53 | 55 | support for .NET Core | |
| 54 | - - .NET and Python exceptions are preserved when crossing Python/.NET boundary | ||
| 56 | + - BREAKING: .NET and Python exceptions are preserved when crossing Python/.NET boundary | ||
| 55 | 57 | - BREAKING: custom encoders are no longer called for instances of `System.Type` | |
| 56 | 58 | - `PythonException.Restore` no longer clears `PythonException` instance. | |
| 57 | 59 | - Replaced the old `__import__` hook hack with a PEP302-style Meta Path Loader | |
| 58 | 60 | - BREAKING: Names of .NET types (e.g. `str(__class__)`) changed to better support generic types | |
| 59 | 61 | - BREAKING: overload resolution will no longer prefer basic types. Instead, first matching overload will | |
| 60 | 62 | be chosen. | |
| 63 | + - BREAKING: .NET collections and arrays are no longer automatically converted to | ||
| 64 | + Python collections. Instead, they implement standard Python | ||
| 65 | + collection interfaces from `collections.abc`. | ||
| 66 | + See [Mixins/collections.py](src/runtime/Mixins/collections.py). | ||
| 67 | + - BREAKING: When trying to convert Python `int` to `System.Object`, result will | ||
| 68 | + be of type `PyInt` instead of `System.Int32` due to possible loss of information. | ||
| 69 | + Python `float` will continue to be converted to `System.Double`. | ||
| 61 | 70 | ||
| 62 | 71 | ### Fixed | |
| 63 | 72 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,6 +116,25 @@ public void ConvertOverflow() | |||
| 116 | 116 | } | |
| 117 | 117 | } | |
| 118 | 118 | ||
| 119 | + [Test] | ||
| 120 | + public void ToNullable() | ||
| 121 | + { | ||
| 122 | + const int Const = 42; | ||
| 123 | + var i = new PyInt(Const); | ||
| 124 | + var ni = i.As<int?>(); | ||
| 125 | + Assert.AreEqual(Const, ni); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + [Test] | ||
| 129 | + public void ToPyList() | ||
| 130 | + { | ||
| 131 | + var list = new PyList(); | ||
| 132 | + list.Append("hello".ToPython()); | ||
| 133 | + list.Append("world".ToPython()); | ||
| 134 | + var back = list.ToPython().As<PyList>(); | ||
| 135 | + Assert.AreEqual(list.Length(), back.Length()); | ||
| 136 | + } | ||
| 137 | + | ||
| 119 | 138 | [Test] | |
| 120 | 139 | public void RawListProxy() | |
| 121 | 140 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments