-
Notifications
You must be signed in to change notification settings - Fork 747
Enable C# parameters of type object
accept any argument, passed from Python
#853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
|
Could you please reopen this? |
@filmor , am I understanding it correctly, that Python-based tests need to be fixed appropriately? |
I didn't check yet in detail what this PR broke, I just want to keep it on the radar :) |
…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
…ssed from Python (pythonnet#853)" (pythonnet#882) This reverts commit 43c972d.
What does this implement/fix? Explain your changes.
Previously when a C# method with a parameter of type
object
was called from Python with some argument of a native Python type (e.g. instance ofdict
rather 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 intoPyObject
and passed to theobject
parameter.For example:
Before change: overload not found
After change:
anything
inCallMe
is an instance ofPyObject
, wrapping adict
instance, soCallMe
outputs{}
Does this close any currently open issues?
#811
Checklist
Check all those that are applicable and complete.
AUTHORS
CHANGELOG