Skip to content

Support for byref parameters when overriding .NET methods from Python #1663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Jan 6, 2022

What does this implement/fix? Explain your changes.

This supports overriding virtual .NET methods that have out or ref parameters from Python.

The new code is emitted to

  1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly
  2. marshal those new values from the args array back into arguments in generated IL

Does this close any currently open issues?

fixes #1481

Additional notes

Related to #1364

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
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

…Python

new code is emitted to
1. unpack the tuple returned from Python to extract new values for byref parameters and modify args array correspondingly
2. marshal those new values from the args array back into arguments in IL

fixes pythonnet#1481
@lostmsu lostmsu force-pushed the bugs/PythonOutInterfaceImpl branch from c3ace5b to decc95f Compare January 6, 2022 23:47
@lostmsu lostmsu merged commit 7450c5c into pythonnet:master Jan 7, 2022
@lostmsu lostmsu deleted the bugs/PythonOutInterfaceImpl branch January 8, 2022 15:49
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.

Calling overridden method with out parameter from C# to python results in 0xC0000005 (Access Violation)
2 participants