Skip to content

Conversation

@ElminsterAU
Copy link

...allow controlling ownership from python. methods return Self to allow chaining

…low controlling ownership from python. methods return Self to allow chaining
@lmbelo
Copy link
Member

lmbelo commented Nov 23, 2021

Can you please describe a use case?

@ElminsterAU
Copy link
Author

claim: you called a function on a delphi object that returned a new object for which you are responsible for freeing it, by claiming it the object will be freed once no more python references exist

release: you created a delphi object in a way that python has ownership, you want to pass that object as a parameter to a call, where called function will then take ownership of that object and you are no longer allowed to just free it yourself at anytime, you can use release to prevent python from automatically freeing the delphi object when the last python reference to it is gone.

@pyscripter
Copy link
Collaborator

Interesting.
Could you please write unit tests and submit it to pyscripter/python4delphi.

@pyscripter
Copy link
Collaborator

pyscripter commented Jul 19, 2022

Wouldn't it be simpler just to make the owned property writable?

pyscripter added a commit to pyscripter/python4delphi that referenced this pull request Dec 29, 2022
__owned__ is now Read-Write property
Copy link
Collaborator

@checkdigits checkdigits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No response from OP.

Rejecting PR.

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.

4 participants