Added a decoder to be able to handle Func<> parameters by Romout · Pull Request #2049 · pythonnet/pythonnet
Repository navigation
Added a decoder to be able to handle Func<> parameters - #2049
Open
Romout wants to merge 4 commits into pythonnet:master from Romout:feature-FuncDecoder
Open
Added a decoder to be able to handle Func<> parameters #2049 Romout wants to merge 4 commits into pythonnet:master from Romout:feature-FuncDecoder
Conversation
Romout commented Dec 15, 2022 · edited Loading
Copy link Copy Markdown
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
Added a decoder to be able to handle Func<> parameters by means of la...
d9e790a
...mbdas or similar without the need of casting to System.Func
koubaa commented Dec 20, 2022
Copy link Copy Markdown
Contributor
|
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 commented Dec 11, 2023
Copy link Copy Markdown
Author
|
I don't know why the build for 3.7 on 32bit didn't succeed. Can someone help with that? |
Some additional stuff to finalize the pull request
96992fb
Merge branch 'master' into feature-FuncDecoder
eb1c2f3
Merge branch 'master' into feature-FuncDecoder
830cc11
This branch has not been deployed
No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment