Added `ToPythonAs()` extension method for explicit conversion using an arbitrary type by joaompneves · Pull Request #2419 · pythonnet/pythonnet
Repository navigation
Added ToPythonAs() extension method for explicit conversion using an arbitrary type - #2419
Open
joaompneves wants to merge 14 commits into pythonnet:master from joaompneves:support-specific-type-encoding
Open
Added ToPythonAs() extension method for explicit conversion using an arbitrary type #2419
joaompneves wants to merge 14 commits into
pythonnet:master from
joaompneves:support-specific-type-encoding
Conversation
joaompneves commented Jul 17, 2024 · edited Loading
Copy link Copy Markdown
What does this implement/fix? Explain your changes.
When you have an object that implements multiple interfaces in an explicit way, there's no easy way to specify which of the interface we want to encode, when the interface type is not known at build time.
This PR allows that, by introducing an overload with and extra type parameter in the ToPythonAs method.
...
Does this close any currently open issues?
...
Any other comments?
...
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
Encoders no support specifying the target encoding type
1ef1e7b
lostmsu commented Jul 17, 2024 · edited Loading
Copy link Copy Markdown
Member
|
Can you please provide an example of how this can be used? Even better if it is a real-world usage example. |
Fix build
255201a
Add unit test
37c4d04
Revert unnecessary changes
4fbf04c
Add test description
cf8ff1f
Remove warning
bc11136
joaompneves
changed the title
Encoders no support specifying the target encoding type
Added ToPythonAs() extension method for explicit conversion using an arbitrary type
Jul 18, 2024
joaompneves
and others
added 4 commits
July 18, 2024 18:10
Update authors and changelog
1073b03
@microsoft-github-policy-service agree
Update CHANGELOG.md
b5a18d1
Revert unintentional changes
Update CHANGELOG.md
37ec583
Update CHANGELOG.md
ad7f985
joaompneves
commented
Jul 18, 2024
View reviewed changes
Comment thread src/embed_tests/Python.EmbeddingTest.csproj
Outdated
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>net472;net6.0</TargetFrameworks> | ||
| <RollForward>LatestMajor</RollForward> |
joaompneves commented Jul 18, 2024
Copy link Copy Markdown
Author
Added a test. |
View reviewed changes
Comment thread src/embed_tests/Python.EmbeddingTest.csproj
Outdated
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>net472;net6.0</TargetFrameworks> | ||
| <RollForward>LatestMajor</RollForward> |
| /// </remarks> | ||
| public static PyObject FromManagedObject(object ob) | ||
| public static PyObject FromManagedObject(object ob , Type? type = null ) | ||
| { |
CR
bac598f
Merge branch 'support-specific-type-encoding' of https://github.com/j...
e04b6c4
...oaompneves/pythonnet into support-specific-type-encoding * 'support-specific-type-encoding' of https://github.com/joaompneves/pythonnet: Update CHANGELOG.md Update CHANGELOG.md Update CHANGELOG.md
Revert file
8bb7519
joaompneves
requested a review
from lostmsu
July 29, 2024 14:25
Merge branch 'master' into support-specific-type-encoding
78d39d5
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