-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Refactor setattrbehavior calls #227
Refactor setattrbehavior calls #227
Conversation
I'm also somewhat confused with the original code... doesn't it all need updated to use
?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that there is no reference stealing happening in the new version and that your usage of valueptr looks fine to me.
Can you specify which line you are referring to ? |
Like here https://github.com/nucleic/atom/blob/main/atom/src/setattrbehavior.cpp#L321 I think that is leaking a reference to the returned value? |
I think you are correct. I need to look into stricter tests for references leaks ! |
|
This is not leaking. |
Wait, I'm wrong again. Dammit I'm out of practice. Yes, you are correct. The So, we do need to trap that in a |
But the return value from call is a PyObject*. In general it should be None which is immortal so leaking a reference does not matter but to be perfectly correct we should still decrease it, no ? |
Then I made a not too bad mistake quite some time ago and we can now fix it. Good. |
It might be less error prone make the handler's return a PyObject* and do one check in Member::setattr? Edit: Nevermind I guess that wouldn't always work. |
While I wouldn't be opposed to that in theory, it would touch a lot of the other various |
It looks like full_validate is not called on the propery_handler value? |
IIRC that is correct. IIRC there wasn't enough room in the |
Keep in mind that this library is well over 10 years old now and was heavily influenced by Enthought Traits. The |
To be honest the Property member and its behavior are weird to me. I will let @sccolbert comment. |
Yeah. If I were to write the library again today, |
Like you started the discussion on enaml maybe we could start a discussion on atom. |
Let's do it!!!! |
867fd29
to
bd7395f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #227 +/- ##
=======================================
Coverage 97.67% 97.67%
=======================================
Files 24 24
Lines 1074 1074
Branches 162 162
=======================================
Hits 1049 1049
Misses 12 12
Partials 13 13 |
Please double check my usage of valueptr. It used
valueptr.release()
before but since the args doesn't steal a reference I believevalueptr.get()
is correct.