-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow checks based on values #1
Allow checks based on values #1
Conversation
…tes, deletion of attributes and operands of in-place mutation operations.
(I have signed the Zope contributor agreement already) |
@tseaver any input? |
r = PyObject_CallMethodObjArgs(self->proxy_checker, meth, | ||
self->proxy.proxy_object, name, | ||
NULL); | ||
if (value != NULL |
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.
A couple of style preferences here:
- Please enclose even single-statement suites in braces (FBO later edits by indenttion-centric Python developers).
- Can you add / fix comments for each suite? I think the one in line #187 is really for line #203.
Other than the inline comment, the PR looks good to me. I don't think the performance impact is going to be important (but I guess I could be wrong). |
Thanks! Should all be sorted now. Ready for merge / release whenever. |
It looks good to me. I'm going to ask @jimfulton to review for performance impact, as I don't actually use the checkers in production. |
@tseaver @jimfulton bump |
I have now lost access to the repository from which this pull request was made. If it needs rebasing, this will have to be done elsewhere. |
I pushed your changes to the mitchellrj-extended-setattr-behavior branch in this repo so they don't get lost. |
Superseded by PR #25. |
This pull request adds the ability to perform checks based on:
__iadd__
,__imul__
, etc) which would normally be called withcheck
rather thancheck_getattr
.It achieves this by adding a new interface with the following extra check methods which are called by the proxy objects if provided:
check_setattr_with_value
: for checks based on values to be assigned to attributes. Signature is ascheck_setattr
except with an extravalue
parameter.check_with_value
: for checks based on operands of in-place mutation operations. Signature is ascheck
except with an extravalue
parameter.check_delattr
: for checks based on attribute deletion rather than mutation.