Repository navigation
RawProxyEncoder - #1122
Merged
Merged
RawProxyEncoder#1122
Conversation
Now Python host can force raw encoding for autoconverted .NET types. Enables workaround for pythonnet#514
lostmsu
force-pushed
the
PR/RawProxyEncoderBase
branch
from
April 23, 2020 18:34
a0fed9a to
213afb6
Compare
AlexCatarino
pushed a commit
to QuantConnect/pythonnet
that referenced
this pull request
Jun 29, 2020
Now Python host can force raw encoding for autoconverted .NET types. Enables workaround for pythonnet#514
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1122 +/- ##
=======================================
Coverage 86.66% 86.66%
=======================================
Files 1 1
Lines 300 300
=======================================
Hits 260 260
Misses 40 40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now Python host can force raw encoding for autoconverted .NET types.
What does this implement/fix? Explain your changes.
This class allows Python to override some automatic conversions done by Python.NET, which was otherwise impossible.
To do that, Python code can define a class derived from
RawProxyEncoder, and overrideCanEncodeto returnTruefor the desired types. Create an instance of this class, and register it withPython.Runtime.PyObjectConversions.RegisterEncoder(instance)(see new test for example)Does this close any currently open issues?
Enables workaround for #514
Checklist
Check all those that are applicable and complete.
AUTHORSCHANGELOG