Skip to content

Implement writing the __cause__ attribute on exceptions#287

Merged
den-run-ai merged 2 commits intopythonnet:masterfrom
filmor:add-cause
Nov 21, 2016
Merged

Implement writing the __cause__ attribute on exceptions#287
den-run-ai merged 2 commits intopythonnet:masterfrom
filmor:add-cause

Conversation

@filmor
Copy link
Member

@filmor filmor commented Nov 10, 2016

No description provided.

@den-run-ai
Copy link
Contributor

No tests? :)

@filmor
Copy link
Member Author

filmor commented Nov 10, 2016

That's why it reads "WIP" ;)

@filmor filmor changed the title [WIP] Implement writing the __cause__ attribute on exceptions. Implement writing the __cause__ attribute on exceptions. Nov 14, 2016
@filmor
Copy link
Member Author

filmor commented Nov 14, 2016

Tests added, could someone comment on whether the XIncref there is correct? I take it GetInstHandle doesn't increase the ref-count by itself?

@filmor filmor changed the title Implement writing the __cause__ attribute on exceptions. Implement writing the __cause__ attribute on exceptions Nov 14, 2016
@den-run-ai
Copy link
Contributor

@filmor you can always stress-test for memory growth of this exception in a for-loop.

Looks like it is NOT needed to call XIncref like in this case:

IntPtr op = CLRObject.GetInstHandle(ob);

Note that PyObject(IntPtr tp) constructor does not incref the ref. count.

@filmor
Copy link
Member Author

filmor commented Nov 19, 2016

@denfromufa @vmuriart @tonyroberts Please review.

@tonyroberts
Copy link
Contributor

I don't think an incref is necessary as the CLRObject constructor creates a new python object (so reference count of 1) and never decrefs it.

@filmor
Copy link
Member Author

filmor commented Nov 21, 2016

Yep, changed that already.

@den-run-ai den-run-ai merged commit 071f25d into pythonnet:master Nov 21, 2016
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.

3 participants