FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added a decoder to be able to handle Func<> parameters by Romout · Pull Request #2049 · pythonnet/pythonnet · GitHub

Repository navigation

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

Open
Romout wants to merge 4 commits into
pythonnet:masterfrom
Romout:feature-FuncDecoder
Open

Romout wants to merge 4 commits into
pythonnet:masterfrom
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

…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?

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL