Improved Type Interop with CLR #2055
Closed
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.
What does this implement/fix? Explain your changes.
This PR addresses these issues:
__namespace__, more than once, would throwType Existsexceptionsuper().VirtualMethod()inside a python-derived virtual method, would result in an infinite loopDue to the nature of the changes, this is a single PR instead of multiple smaller ones.
After PR merge:
NotImplementedexception.__namespace__is not required to created aClassDerivedanymore. All python derived classes are now represented byClassDerivedin managed memory.ClassDerivednow caches generated types based on namespace, type name, and chain of base classes. This avoids regenerating types or throwingType Already Existsexceptions. A new format for generated type names include full name of base class and interfaces in the typename. The naming format still ends in the python type name to be backward compatible and passes the unit testsSubClass, deriving fromBaseClassand implementingBaseInterface1andBaseInterface2:Python.Runtime.Dynamic.BaseClass__BaseInterface1__BaseInterface2__main__SubClasssuper().__init__()pattern.super().method()pattern.OriginalMethodandRedirectedMethod) are now used to mark the original and redirected virtual methods. The method name format forOriginalMethodis changed to$"_BASEVIRTUAL__{name}"so it can handle calling original methods on base classes that does not match the name of current class. Previously this was not working.Does this close any currently open issues?
Potentially (no tests have been done to ensure these issues are resolved)
Any other comments?
...
Checklist
Check all those that are applicable and complete.
AUTHORSCHANGELOG