-
Notifications
You must be signed in to change notification settings - Fork 753
Drop List and IEnumerable conversions #963
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
6e202f6
to
f1df348
Compare
f1df348
to
ea8df83
Compare
Just want to confirm if we are to bump up major version with it. Seems like a non-trivial change, that might break a lot of things, that are working now. It is not immediately obvious from this change, but if I used to pass an array to a parameter, that expects Python |
I'm trying to keep the amount of changes in behaviour to a minimum. I'm not going to bump the major version (i.e. this will not be 3.0) but instead the minor version 2.5 as I've had enough of the "lists behave weirdly" kind of issues we are seeing since this was introduced. .NET array objects are still |
@filmor what about functions, that do |
That is the second paragraph of my comment ;)
|
@filmor I meant that previously when you pass a |
|
@filmor "should be used" but not "already used". Are you planning to implement |
This PR is a draft, I plan to work on it until all tests pass. If that means implementing |
What's the rationale for this please? |
The rationale is the huge number of issues related to the automatic conversion. Just being able to use a .NET |
OK, thanks. It would be nice to close down a bunch of issues. |
Any chance of getting a look at those issues? |
@filmor First of all, thanks for providing such a great library! Do you think this can go in as part of the 2.5 release? I see it's not in the RC, but would love to see this fixed. |
@mmisol Sorry, 2.5 is a minor release, we can't break the API even though it would be an improvement. |
@mmisol injecting a no-op codec will allow you to override this behavior with 2.5: https://github.com/pythonnet/pythonnet/blob/master/src/runtime/Codecs/RawProxyEncoder.cs E.g. (might contain errors) class RawListEncoder: RawProxyEncoder {
public override bool CanEncode(Type type)
=> type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>);
}
PyObjectConversions.RegisterEncoder(new RawListEncoder()); See also an example from Python side: f707698#diff-f8910e440ff4d17505744bd4c7016697R706 |
I think this has been superseded in 3.0 branch. These default conversions are no longer enabled but can be reimplemented with codecs. |
What does this implement/fix? Explain your changes.
Drop implicit conversion of
List<>
andIEnumerable
.Does this close any currently open issues?
Heaps, I'll list them later
Any other comments?
Breaks the interface, so we'll have to announce this loudly and raise the minor version number.
Checklist
Check all those that are applicable and complete.
AUTHORS
CHANGELOG