From ff898115ddca246ba0c367dc3d693d6ed1c1be9d Mon Sep 17 00:00:00 2001 From: Victor Milovanov Date: Tue, 8 Dec 2020 10:16:40 -0800 Subject: [PATCH] Parameters marked with `ParameterAttributes.Out` are no longer returned in addition to the regular method return value (unless they are passed with `ref` or `out` keyword). --- CHANGELOG.md | 4 +++- src/runtime/methodbinder.cs | 2 +- src/tests/test_method.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c3f389d6..2aa1944eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,11 +18,13 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. details about the cause of the failure - `clr.AddReference` no longer adds ".dll" implicitly - `PyIter(PyObject)` constructor replaced with static `PyIter.GetIter(PyObject)` method -- Return values from .NET methods that return an interface are now automatically +- BREAKING: Return values from .NET methods that return an interface are now automatically wrapped in that interface. This is a breaking change for users that rely on being able to access members that are part of the implementation class, but not the interface. Use the new __implementation__ or __raw_implementation__ properties to if you need to "downcast" to the implementation class. +- BREAKING: Parameters marked with `ParameterAttributes.Out` are no longer returned in addition + to the regular method return value (unless they are passed with `ref` or `out` keyword). ### Fixed diff --git a/src/runtime/methodbinder.cs b/src/runtime/methodbinder.cs index bd6eb32ba..69b7908e9 100644 --- a/src/runtime/methodbinder.cs +++ b/src/runtime/methodbinder.cs @@ -534,7 +534,7 @@ static object[] TryConvertArguments(ParameterInfo[] pi, bool paramsArray, Runtime.XDecref(op); } - if (parameter.IsOut || isOut) + if (isOut) { outs++; } diff --git a/src/tests/test_method.py b/src/tests/test_method.py index f6522e49e..8cec02ddc 100644 --- a/src/tests/test_method.py +++ b/src/tests/test_method.py @@ -761,7 +761,7 @@ def test_we_can_bind_to_encoding_get_string(): read = 1 while read > 0: - read, _ = stream.Read(buff, 0, buff.Length) + read = stream.Read(buff, 0, buff.Length) temp = Encoding.UTF8.GetString(buff, 0, read) data.append(temp)