-
Notifications
You must be signed in to change notification settings - Fork 747
Retry: Enable C# parameters of type object
accept any argument, passed from Python
#889
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
@filmor is there an instruction to run Python unit tests? |
You can run the unit tests by using pytest (either just |
9e07d3a
to
f83d8fc
Compare
Codecov Report
@@ Coverage Diff @@
## master #889 +/- ##
=======================================
Coverage 86.75% 86.75%
=======================================
Files 1 1
Lines 302 302
=======================================
Hits 262 262
Misses 40 40
Continue to review full report at Codecov.
|
@filmor AppVeyor failed for 3.6 x86 due to connectivity issue on the VM: https://ci.appveyor.com/project/pythonnet/pythonnet/builds/28271316 . Results are not being picked up. |
…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
2f7b0e9
to
102239a
Compare
102239a
to
6373197
Compare
…m Python (pythonnet#889) * added a regression test for pythonnet#881 * 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 * fixed ObjectField conversion test * fixed test_object_indexer to pass on custom class key * use object() instance in OverloadResolution_UnknownToObject test
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
P.S.
This is a retry of #853