Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Sep 5, 2021

What does this implement/fix? Explain your changes.

Calls tp_clear (if any) of base unmanaged type when a reflected CLR object instance is cleared.

Does this close any currently open issues?

#1476

Any other comments?

C# exceptions inherit from Python BaseException class, which has tp_clear. Prior to this change it was not called when Python deallocated them leaving dangling references to BaseException.args and BaseException.__cause__.

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change

…ject instance is cleared

fixes pythonnet#1476 : C# exceptions inherit from Python BaseException class, which has tp_clear. Prior to this change it was not called, leaving dangling references to BaseException.args and BaseException.__cause__.call tp_clear of base unmanaged type when a reflected CLR object instance is cleared

fixes pythonnet#1476 : C# exceptions inherit from Python BaseException class, which has tp_clear. Prior to this change it was not called, leaving dangling references to BaseException.args and BaseException.__cause__.
@lostmsu
Copy link
Member Author

lostmsu commented Sep 5, 2021

@amos402 can you review this one?

The 3.7 MacOS CI failure is preexisting: https://github.com/pythonnet/pythonnet/runs/3267749344

@lostmsu lostmsu merged commit 2ef6b50 into pythonnet:master Sep 14, 2021
@lostmsu lostmsu deleted the bugs/MemLeak-CatchingExceptions branch September 14, 2021 19:18
@lostmsu lostmsu restored the bugs/MemLeak-CatchingExceptions branch September 14, 2021 19:28
@lostmsu lostmsu deleted the bugs/MemLeak-CatchingExceptions branch September 14, 2021 19:29
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.

1 participant