Refactor delattrbehavior calls#225
Merged
MatthieuDartiailh merged 1 commit intonucleic:mainfrom Jan 20, 2025
Merged
Conversation
sccolbert
approved these changes
Jan 18, 2025
Member
|
I thought about this before I approved the changes, but the attribute
exception error I think would be "sufficient enough" since it would be
something like "object has no attribute `_del_foo`".
…On Sat, Jan 18, 2025 at 11:57 AM Matthieu Dartiailh < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In atom/src/delattrbehavior.cpp
<#225 (comment)>:
> @@ -155,17 +155,7 @@ _mangled_property_handler( Member* member, CAtom* atom )
cppy::ptr name( PyUnicode_FromFormat( "_del_%s", suffix ) );
if( !name )
return -1;
- cppy::ptr callable( PyObject_GetAttr( pyobject_cast( atom ), name.get() ) );
- if( !callable )
- {
- if( PyErr_ExceptionMatches( PyExc_AttributeError ) )
- PyErr_SetString( PyExc_AttributeError, "can't delete attribute" );
Losing this means we lose on the quality of the error message. It is sad
we cannot preserve it while improving performance.
Would creating the method and then calling it with a better PyObject_Call
make it much worse than the current solution.
—
Reply to this email directly, view it on GitHub
<#225 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABBQSI5FYJL6VWHPUFFDGL2LKIYNAVCNFSM6AAAAABVN2NHTGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNRQGQ4TEOJVGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Contributor
Author
|
Looks ok to me if I did this right.. |
a05834c to
735042e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #225 +/- ##
=======================================
Coverage 97.67% 97.67%
=======================================
Files 24 24
Lines 1074 1074
Branches 162 162
=======================================
Hits 1049 1049
Misses 12 12
Partials 13 13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same thing for delattr