Skip to content

Allow decoders to decode Python types derived from primitives #1986

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

Merged
merged 2 commits into from
Oct 28, 2022

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Oct 24, 2022

What does this implement/fix? Explain your changes.

When a Python instance needs to be converted to System.Object, and the Python type is derived from one of the primitives (e.g. numpy.float64 is derived from float), allow a custom decoder to override the default behavior (which would have been converting to System.Double).

Does this close any currently open issues?

It addresses the primary concern of #1957

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change

…s when target type is System.Object

useful to be able to change what numpy.float64 is converted to

related to pythonnet#1957

this is an alternative to pythonnet#1958
@filmor
Copy link
Member

filmor commented Oct 28, 2022

Looks good to me. I think this is a good stepping stone to eventually retire built-in primitive conversion in favour of using codecs for everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants