Skip to content
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

Added a decoder to be able to handle Func<> parameters #2049

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Romout
Copy link

@Romout Romout commented Dec 15, 2022

What does this implement/fix? Explain your changes.

It's a decoder to ease use of C# Func<> method arguments. Previously, it was necessary to cast the python lambda expression to System.Func[...] which is very cumbersome for a script-user.

Does this close any currently open issues?

Was not my intention.

Any other comments?

The solution I used is quite complex as it needs to create wrapper types for each Func-Type-Variant. Code creation is implemented using the IL Code Generator, types are cached, generic type arguments are again converted using ToPython()

I hope my change is of some help!

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Ensure you have signed the .NET Foundation CLA
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

…mbdas or similar without the need of casting to System.Func
@koubaa
Copy link
Contributor

koubaa commented Dec 20, 2022

FWIW I attempted a function codec before - and it was mentioned in the PR that it should have used code generation to be more correct: pythonnet/codecs#1

@Romout
Copy link
Author

Romout commented Dec 11, 2023

I don't know why the build for 3.7 on 32bit didn't succeed. Can someone help with that?

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.

None yet

2 participants