Enable C# parameters of type object accept any argument, passed from Python#853
Merged
filmor merged 4 commits intopythonnet:masterfrom Jun 17, 2019
Merged
Conversation
…instead of failing This enables overload resolution with object parameters to behave the same way PyObject parameters behave - e.g. allow any Python object to be passed as PyObject as fallback. Resolves pythonnet#811
Codecov Report
@@ Coverage Diff @@
## master #853 +/- ##
=========================================
Coverage ? 77.01%
=========================================
Files ? 64
Lines ? 5935
Branches ? 975
=========================================
Hits ? 4571
Misses ? 1034
Partials ? 330
Continue to review full report at Codecov.
|
Member
|
Could you please reopen this? |
Member
Author
|
@filmor , am I understanding it correctly, that Python-based tests need to be fixed appropriately? |
Member
|
I didn't check yet in detail what this PR broke, I just want to keep it on the radar :) |
4 tasks
AlexCatarino
pushed a commit
to QuantConnect/pythonnet
that referenced
this pull request
Jun 18, 2020
…m Python (pythonnet#853) * added a regression test for pythonnet#881 pythonnet#811 * when converting to object, wrap values of unknown type into PyObject instead of failing This enables overload resolution with object parameters to behave the same way PyObject parameters behave - e.g. allow any Python object to be passed as PyObject as fallback. Resolves pythonnet#811
AlexCatarino
pushed a commit
to QuantConnect/pythonnet
that referenced
this pull request
Jun 18, 2020
…ssed from Python (pythonnet#853)" (pythonnet#882) This reverts commit 43c972d.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
Previously when a C# method with a parameter of type
objectwas called from Python with some argument of a native Python type (e.g. instance ofdictrather than instance ofSystem.Random), that would be considered a parameter type mismatch, so overload resolution would fail, and the C# method would not be called.After this change, when Python tries to pass a argument of some Python type to a C# parameter of type
object, that overload would be considered good for resolution, and the argument will be wrapped intoPyObjectand passed to theobjectparameter.For example:
Before change: overload not found
After change:
anythinginCallMeis an instance ofPyObject, wrapping adictinstance, soCallMeoutputs{}Does this close any currently open issues?
#811
Checklist
Check all those that are applicable and complete.
AUTHORSCHANGELOG