[Out] parameters no longer added to return tuple#1308
[Out] parameters no longer added to return tuple#1308filmor merged 1 commit intopythonnet:masterfrom
Conversation
…ed in addition to the regular method return value (unless they are passed with `ref` or `out` keyword).
b7e2699 to
ff89811
Compare
|
I think this was included for compatibility with IronPython. How would you handle out parameters that still have automatic conversions like |
Codecov Report
@@ Coverage Diff @@
## master #1308 +/- ##
===========================================
- Coverage 87.88% 74.04% -13.85%
===========================================
Files 1 1
Lines 289 289
===========================================
- Hits 254 214 -40
- Misses 35 75 +40
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
@filmor this is the confusing part. This change does not affect This annotation is normally meant for P/Invoke marshaling scenarios, where you have to add |
|
For an instance of API difference between implementations in regards to In .NET Core In Mono it is present for COM-compatibility: https://github.com/mono/mono/blob/c5b88ec4f323f2bdb7c7d0a595ece28dae66579c/mcs/class/referencesource/mscorlib/system/io/memorystream.cs#L339 Without this change the same Python code would not work with both Mono and .NET Core. |
|
Thanks for the explanation. I ran into this problem while testing .NET Core and couldn't really make sense of it, wasn't aware of |
Parameters marked with
ParameterAttributes.Out(aka[Out]) are no longer returned in addition to the regular method return value (unless they are passed withreforoutkeyword).What does this implement/fix? Explain your changes.
As it is now possible to pass raw .NET objects to .NET methods, there's no need to marshal
[Out]parameters back to Python manually. Python users can simply access modified object's data directly.Any other comments?
It was confusing to see
read, _ = stream.Read(buff, 0, buff.Length)in the test code, asReadmethod does not really have anyoutorrefparameters. It also failed on some .NET implementations, as the corresponding parameter does not always have an[Out]attribute.Related issues
This should unblock #1307 (tests there are failing because of this difference).
Checklist
Check all those that are applicable and complete.
AUTHORSCHANGELOG